Fix: use Link component to prevent page reload flash
This pull request primarily updates the peer property for several dependencies in the frontend/package-lock.json file and refactors navigation in the Navbar component to use React Router's Link instead of anchor tags. These changes improve dependency management and ensure proper client-side routing in the application.
Dependency management improvements:
- Added or restored the
"peer": trueproperty to many dependencies infrontend/package-lock.jsonto correctly indicate peer dependencies, which helps with package resolution and compatibility in the project. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] - Removed the
"peer": trueproperty from some dependencies where it was no longer needed. [1] [2] [3] [4] [5] [6] - Deleted the
yamlpackage entry frompackage-lock.json, possibly as a cleanup of unused or unnecessary dependencies.
Frontend navigation refactor:
- Updated the
Navbarcomponent (frontend/src/components/Navigation/Navbar/Navbar.tsx) to use theLinkcomponent from React Router for navigation instead of<a>tags, ensuring client-side routing and preventing full page reloads. [1] [2] [3]
Before
https://github.com/user-attachments/assets/a9f15d63-11f6-4a23-a219-0257c9863bcb
After
https://github.com/user-attachments/assets/42a0dde9-4953-4a05-a4f6-d32a4959f8cb
Summary by CodeRabbit
- Refactor
- Enhanced internal navigation system for improved performance and stability.
Walkthrough
Replaces standard HTML anchor tags with React Router Link components in the Navbar component for internal page navigation. Adds import statement for Link from react-router and updates two navigation links (logo and settings) to use client-side routing instead of full page reloads.
Changes
| Cohort / File(s) | Summary |
|---|---|
Navigation refactoring frontend/src/components/Navigation/Navbar/Navbar.tsx |
Replaces anchor (<a>) tags with React Router <Link> components for internal navigation; adds Link import from react-router; updates logo link (/) and settings link (/settings) to use to prop instead of href; no behavioral logic changes |
Estimated code review effort
π― 1 (Trivial) | β±οΈ ~5 minutes
- Straightforward tag replacement with consistent pattern across two locations
- Single import addition
- No conditional logic or complex state management involved
Poem
π° Links now dance with Router's grace,
No page reloads in this race,
Anchor tags fade to memory,
Client-side routing sets us free! π―
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title directly describes the main change: replacing anchor tags with React Router Link components to prevent page reload flash in the Navbar component. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between 8dbc960ffb179df8c12179a18efdbc9b0d9724a1 and 3fd9cf6ec73ad9e162c6c1b319671d13e91a9faf.
β Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
π Files selected for processing (1)
frontend/src/components/Navigation/Navbar/Navbar.tsx(3 hunks)
π Additional comments (3)
frontend/src/components/Navigation/Navbar/Navbar.tsx (3)
24-27: LGTM! Logo link properly converted to client-side navigation.The conversion from anchor tag to Link component is correct, maintaining the className and nested structure. This will prevent full page reloads when navigating to the home page.
86-92: LGTM! Settings link properly converted to client-side navigation.The conversion from anchor tag to Link component is correct, maintaining the className and avatar image. This will prevent full page reloads when navigating to the settings page.
9-9: β Import path is correct for React Router v7.The import statement uses the correct path for React Router v7, as v7's components should be imported from "react-router" rather than "react-router-dom". The code is compliant with v7 specifications.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
β οΈ No issue was linked in the PR description. Please make sure to link an issue (e.g., 'Fixes #issue_number')
Related issue #637
β οΈ No issue was linked in the PR description. Please make sure to link an issue (e.g., 'Fixes #issue_number')
releted issue #636
@rahulharpal1603 can you take a look
β οΈ This PR has merge conflicts.
Please resolve the merge conflicts before review.
Your PR will only be reviewed by a maintainer after all conflicts have been resolved.
πΊ Watch this video to understand why conflicts occur and how to resolve them: https://www.youtube.com/watch?v=Sqsz1-o7nXk
β οΈ This PR still has unresolved merge conflicts and has been inactive for the past 30 days.
The PR has merge conflicts label is still applied, and there has been no recent activity on this PR.
Please resolve the merge conflicts or leave a comment if you are still actively working on it.
If there is no further activity within the next 5 days, this PR may be automatically closed to help keep the PR backlog manageable.
π Closing this PR due to unresolved merge conflicts and prolonged inactivity.
This PR still had unresolved merge conflicts, and there was no activity within 5 days of the stale warning being posted.
You may reopen this PR or submit a new one after resolving the merge conflicts.