PictoPy icon indicating copy to clipboard operation
PictoPy copied to clipboard

fix(navigation): prevent full reload when clicking profile avatar (#636)

Open Akash1xe opened this issue 1 year ago • 6 comments

What this PR fixes

Fixes the white-screen flash when clicking the profile avatar in the navbar.

The issue was caused by using <a href="/settings">, which triggers a full page reload in React/Vite/Tauri. This produces a white flash before the settings page loads.

What I changed

  • Replaced <a href="/settings"> with client-side navigation using useNavigate().
  • This ensures smooth SPA navigation without reloading the page.

Related Issue

Closes #636

Checklist

  • [x] Smooth navigation to /settings
  • [x] No white-screen flash
  • [x] Code formatted correctly
  • [x] Tests pass locally

Summary by CodeRabbit

  • Style

    • Updated user avatar styling to remove the click cursor, clarifying it is non-clickable while retaining hover visual feedback.
  • Improvements

    • Reworked the settings link to use programmatic navigation for more reliable in-app routing and interaction.

Akash1xe avatar Nov 17 '25 09:11 Akash1xe

Walkthrough

Replaced the avatar's anchor link with React Router's useNavigate for programmatic client-side routing to /settings; removed cursor-pointer from the avatar container while keeping hover ring behavior.

Changes

Cohort / File(s) Summary
Navbar routing enhancement
frontend/src/components/Navigation/Navbar/Navbar.tsx
Replaced anchor-based navigation with React Router useNavigate call for settings navigation; removed cursor-pointer from avatar container; preserved avatar hover ring; minor formatting adjustments

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Navbar
  participant Router
  participant Settings

  User->>Navbar: click avatar
  activate Navbar
  Navbar->>Router: useNavigate("/settings")
  Router->>Settings: load Settings component (client-side)
  deactivate Navbar
  Note over Router,Settings: No full page reload

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single-file change with small logic replacement and minor styling tweak.
  • Pay attention to:
    • Correct import and usage of useNavigate.
    • No leftover href or anchor elements causing reload.
    • Accessibility: ensure clickable element semantics (e.g., role/button or actual <button>) and keyboard interaction.

Poem

I hopped from link to route so neat, 🐰
No flash, no reload — a gentle feat.
The avatar clicks, the view slides in,
Smooth pathways now where once was din.
A tiny hop, and settings win. ✨

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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing a white-screen flash when clicking the profile avatar by replacing anchor-based navigation with client-side navigation.
Linked Issues check ✅ Passed The pull request successfully addresses all coding requirements from issue #636 by replacing anchor navigation with useNavigate() for seamless client-side routing without full page reloads.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the navbar navigation issue; only the Navbar component was modified with focused changes to implement client-side routing.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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 17 '25 09:11 coderabbitai[bot]

@Akash1xe this pr is already there #637

srijan2607 avatar Nov 17 '25 18:11 srijan2607

@Akash1xe this pr is already there #637

But I don’t see any pull requests linked to this issue. I believe mine is the first pull request.

Akash1xe avatar Nov 18 '25 08:11 Akash1xe

check out the date

srijan2607 avatar Nov 18 '25 09:11 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]