PictoPy icon indicating copy to clipboard operation
PictoPy copied to clipboard

Fix: use Link component to prevent page reload flash

Open srijan2607 opened this issue 1 year ago β€’ 8 comments

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": true property to many dependencies in frontend/package-lock.json to 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": true property from some dependencies where it was no longer needed. [1] [2] [3] [4] [5] [6]
  • Deleted the yaml package entry from package-lock.json, possibly as a cleanup of unused or unnecessary dependencies.

Frontend navigation refactor:

  • Updated the Navbar component (frontend/src/components/Navigation/Navbar/Navbar.tsx) to use the Link component 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.

srijan2607 avatar Nov 15 '25 21:11 srijan2607

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.json is 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.

❀️ Share

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

coderabbitai[bot] avatar Nov 15 '25 21:11 coderabbitai[bot]

⚠️ No issue was linked in the PR description. Please make sure to link an issue (e.g., 'Fixes #issue_number')

github-actions[bot] avatar Nov 15 '25 21:11 github-actions[bot]

Related issue #637

srijan2607 avatar Nov 15 '25 21:11 srijan2607

⚠️ No issue was linked in the PR description. Please make sure to link an issue (e.g., 'Fixes #issue_number')

github-actions[bot] avatar Nov 15 '25 21:11 github-actions[bot]

releted issue #636

srijan2607 avatar Nov 17 '25 18:11 srijan2607

@rahulharpal1603 can you take a look

srijan2607 avatar Dec 07 '25 07:12 srijan2607

⚠️ 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

github-actions[bot] avatar May 13 '26 07:05 github-actions[bot]

⚠️ 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.

github-actions[bot] avatar Jun 13 '26 06:06 github-actions[bot]

πŸ”’ 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.

github-actions[bot] avatar Jun 18 '26 07:06 github-actions[bot]