Skip to content

Conversation

@Akash1xe
Copy link

@Akash1xe Akash1xe commented Nov 17, 2025

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

  • Smooth navigation to /settings
  • No white-screen flash
  • Code formatted correctly
  • 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

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
Loading

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
frontend/src/components/Navigation/Navbar/Navbar.tsx (2)

25-28: Consider updating the logo link for consistency.

While outside the scope of this PR, note that the logo link on line 25 still uses <a href="/">, which will cause the same full-reload behavior this PR aims to fix. For consistency and a fully seamless SPA experience, consider converting this to use navigate("/") or React Router's <Link> component in a future update.


9-9: Consider standardizing imports to "react-router-dom" for consistency and best practices.

While import { useNavigate } from "react-router" is technically valid in React Router v6, the codebase mixes imports: Link is imported from "react-router-dom" while useNavigate uses "react-router". For web applications (especially with Tauri), the standard and recommended pattern is to import both from "react-router-dom". This import pattern appears across multiple files in the codebase; consider standardizing all useNavigate imports to use "react-router-dom" for consistency.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8dbc960 and 7a58711.

📒 Files selected for processing (1)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (3 hunks)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
frontend/src/components/Navigation/Navbar/Navbar.tsx (2)

87-97: Button implementation looks good with one minor nitpick.

The button correctly addresses the accessibility concerns raised in previous reviews and implements client-side navigation as intended. The aria-label provides good accessibility, and the semantic <button> element ensures keyboard navigation works properly.

Optional cleanup: The cursor-pointer class is redundant since buttons have cursor: pointer by default in browsers. You can simplify the classes:

-            className="p-2 cursor-pointer border-0 bg-transparent"
+            className="p-2 border-0 bg-transparent"

25-28: Consider applying the same navigation pattern to the logo for consistency.

The logo still uses an anchor tag with href="/", which will trigger a full page reload (the same issue this PR fixes for the avatar). For a consistent SPA experience without white-screen flashes, consider using client-side navigation here as well.

Apply this diff to use consistent client-side navigation:

-        <a href="/" className="flex items-center space-x-2">
+        <button 
+          onClick={() => navigate("/")}
+          className="flex items-center space-x-2 border-0 bg-transparent cursor-pointer"
+        >
          <img src="/128x128.png" width={32} height={32} alt="PictoPy Logo" />
          <span className="text-xl font-bold">PictoPy</span>
-        </a>
+        </button>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a58711 and a08a890.

📒 Files selected for processing (1)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (3 hunks)
🔇 Additional comments (2)
frontend/src/components/Navigation/Navbar/Navbar.tsx (2)

19-19: LGTM!

The useNavigate hook is properly instantiated at the component's top level with correct indentation.


9-9: > Likely an incorrect or invalid review comment.

@srijan2607
Copy link

@Akash1xe this pr is already there #637

@Akash1xe
Copy link
Author

@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.

@srijan2607
Copy link

check out the date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: White screen flash when clicking profile avatar in navbar

2 participants