fix(frontend): fix TypeScript error in Back button navigate call #8

Merged
starkSV merged 1 commit from feat/cf-worker-proxy into main 2026-05-18 12:12:28 +05:30
starkSV commented 2026-05-18 12:12:18 +05:30 (Migrated from github.com)

Split ternary into two separate navigate() calls to satisfy TypeScript overload resolution — navigate(delta: number) and navigate(to: To) are distinct overloads that cannot share a ternary return type.

Summary by CodeRabbit

  • Refactor
    • Improved code structure in the product detail page navigation logic with no impact to user experience.

Review Change Stack

Split ternary into two separate navigate() calls to satisfy TypeScript overload resolution — navigate(delta: number) and navigate(to: To) are distinct overloads that cannot share a ternary return type. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved code structure in the product detail page navigation logic with no impact to user experience. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/starkSV/windows-iso-downloader/pull/8?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2026-05-18 12:12:29 +05:30 (Migrated from github.com)

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 86ba26b9-0409-4f6b-9e30-966423ce90a6

📥 Commits

Reviewing files that changed from the base of the PR and between 2e05348a97 and e7b0fea94b.

📒 Files selected for processing (1)
  • frontend/src/pages/ProductDetailPage.tsx

📝 Walkthrough

Walkthrough

The back button click handler in ProductDetailPage is refactored to invoke the appropriate navigation function based on browser history state: navigate(-1) when history state is available, otherwise navigate('/').

Changes

Back Button Navigation Refactor

Layer / File(s) Summary
Back button conditional navigation
frontend/src/pages/ProductDetailPage.tsx
The onClick handler for the back button now uses an inline ternary expression to choose between navigate(-1) and navigate('/') based on the presence of window.history.state?.idx, improving control-flow clarity.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hops back through the page,
No history? Home is the stage—
Logic now clear in each branch,
One line refined with a crunch! 🐰

Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cf-worker-proxy

Comment @coderabbitai help to get the list of available commands and usage tips.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- This is an auto-generated comment: failure by coderabbit.ai --> > [!CAUTION] > ## Review failed > > The pull request is closed. <!-- end of auto-generated comment: failure by coderabbit.ai --> <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: defaults **Review profile**: CHILL **Plan**: Pro Plus **Run ID**: `86ba26b9-0409-4f6b-9e30-966423ce90a6` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2e05348a971329834fa09e585fcbbf25f2576c51 and e7b0fea94b0c9347c25d489dcb30e00f9864b662. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `frontend/src/pages/ProductDetailPage.tsx` </details> </details> --- <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The back button click handler in `ProductDetailPage` is refactored to invoke the appropriate navigation function based on browser history state: `navigate(-1)` when history state is available, otherwise `navigate('/')`. ## Changes **Back Button Navigation Refactor** | Layer / File(s) | Summary | |---|---| | **Back button conditional navigation** <br> `frontend/src/pages/ProductDetailPage.tsx` | The onClick handler for the back button now uses an inline ternary expression to choose between `navigate(-1)` and `navigate('/')` based on the presence of `window.history.state?.idx`, improving control-flow clarity. | ## Estimated code review effort 🎯 1 (Trivial) | ⏱️ ~3 minutes ## Poem > A rabbit hops back through the page, > No history? Home is the stage— > Logic now clear in each branch, > One line refined with a crunch! 🐰✨ </details> <!-- walkthrough_end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> <details> <summary>📝 Generate docstrings</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> Create stacked PR - [ ] <!-- {"checkboxId": "3e1879ae-f29b-4d0d-8e06-d12b7ba33d98"} --> Commit on current branch </details> <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests - [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Commit unit tests in branch `feat/cf-worker-proxy` </details> </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- <sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub> <!-- tips_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAZvAAeABQ+FPgYNBi0AJS+ATCy3CQAygwU8Ny4kJShfPBYAEJoDADWkAJ4BFgYaBLwRNQkjGgeHpCQBgByjgKUXAAcbQYAqjYAMlywuLjciBwA9HNE6rDYAhpMzHOIuM7FSQBqcwDuebT4R4hgSIRnRxge+GhKFHPc2C1zA+1DiL32OxQ9vtBkl8NgKAxGgIqBgGLBfCRqHMGD4wEd8IDKGBePh/PJAEmEMGcpEy0MwcK4zG0WHaSR2uGws34iRpBgAwhRETR6NQuAAmAAMfIAbGABQBWMAARj60AFwo4ABY+RwZQAtIwAEWkqXS4jCXDgjThmFI9m4HnUyDQkBoFGqLiy/l40kQ8DCKHC+Ft6PsJG4zgakGqtXqNECUSaLWQBHs1CQPnk0ASyV1GX4UgoDyekE5iHwHjw7owGhgsEaIbqQYAglYAJKQWBoGO+2hIcSwzL4TPZ2jIQAoBMGalXw0oPDsuBhupRI5h6JWwyRAgRDfhI4Ojgg4U0MBh8JlEE3OehbZQHfJOQ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DEzB4LUB4M2X49BDHXU2mEbacM8wIy/A4ccHd4AvVwLjT640SC/X/sXfI/dihshYBaYCCt74ww8gAXwALqaWwpEfg+F66EWEhnHurds6dxqi3JQfd8AD0QY6Zeo9GLjxYqpdi+ggA= --> <!-- internal state end -->
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: shekhar/windows-iso-downloader#8
No description provided.