Skip to content

Conversation

@varsharaodevaraj
Copy link

@varsharaodevaraj varsharaodevaraj commented Dec 27, 2025

Problem

Clicking the avatar or logo triggered a full page reload (white flash)
because navigation used instead of React Router navigation.

Fix

Replaced with so navigation stays inside the SPA

No reload, smoother UX

Consistent with other internal routes

How to test

1️⃣ Open app
2️⃣ Click the avatar or logo
3️⃣ Navigation happens instantly — no white flash

Fixes: #864

Before:

Screen.Recording.2025-12-27.at.9.02.21.AM.mov

After:

Screen.Recording.2025-12-27.at.9.32.16.AM.mov

Summary by CodeRabbit

Bug Fixes

  • Improved navigation scroll behavior to properly account for sticky header offset, ensuring sections are fully visible when accessed via navigation links.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 2025

📝 Walkthrough

Walkthrough

These changes fix full-page reloads that occurred when clicking navbar elements. The frontend navbar now uses React Router Links instead of anchor elements for logo and settings navigation. The landing page wraps its HomePage content with an identifiable div and implements hash-based smooth scrolling with offset compensation for sticky navbars.

Changes

Cohort / File(s) Summary
Frontend Navbar React Router Migration
frontend/src/components/Navigation/Navbar/Navbar.tsx
Replaces HTML anchor elements with React Router Link components for logo (to HOME) and settings/user links (to SETTINGS) to enable client-side SPA navigation without page reloads. Adds imports for Link and ROUTES constant.
Landing Page Layout & Scroll Navigation
landing-page/src/App.tsx, landing-page/src/Pages/Landing\ page/Navbar.tsx
Wraps HomePage content with div id="home" for scroll targeting. Landing page navbar replaces full-page navigation links with hash-based scroll links (to="#home", isScrollLink={true}) and implements 90px offset-adjusted smooth scrolling via window.scrollTo to account for sticky navbar positioning. Mobile menu links also close menu on navigation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 No more white flashes breaking the flow,
Links now route smoothly, and the app's aglow!
Scroll offsets calculated with care,
Single-page magic floating through air. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Out of Scope Changes check ❓ Inconclusive The changes to landing-page/src/App.tsx and landing-page/src/Pages/Landing page/Navbar.tsx regarding scroll behavior appear to be related to navbar offset handling but may extend beyond the core fix of SPA navigation. Clarify whether the scroll offset changes in the landing page are necessary for issue #864 or represent separate work that should be tracked independently.
✅ Passed checks (3 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 fix: replacing anchor navigation with React Router Link to prevent full page reloads when clicking the avatar or logo.
Linked Issues check ✅ Passed The PR successfully addresses issue #864 by replacing anchor-based navigation with React Router Link components in both the Navbar and landing page, eliminating the full page reload issue.
✨ 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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
landing-page/src/Pages/Landing page/Navbar.tsx (1)

198-206: Hash targets #features and #about are missing from the codebase.

The mobile navigation correctly implements hash-based scroll behavior and properly closes the menu on link clicks. However, the navigation will fail silently for #features and #about because these elements lack corresponding id attributes:

  • #home is properly defined in App.tsx ✓
  • #features is not defined anywhere in the codebase
  • #about is not defined anywhere in the codebase

Add id="features" to the features section (likely landing-page/src/components/ui/Features.tsx) and id="about" to the about section (likely landing-page/src/Pages/HowItWorks/HowItWorks.tsx or equivalent) to enable working navigation.

🧹 Nitpick comments (1)
landing-page/src/Pages/Landing page/Navbar.tsx (1)

30-38: Scroll offset implementation works well; consider making it dynamic.

The 90px offset correctly compensates for the sticky navbar height, and using window.scrollTo provides smooth, controlled scrolling behavior.

For better maintainability, consider calculating the offset dynamically based on the actual navbar height rather than hardcoding the value. This would prevent issues if the navbar height changes in the future.

💡 Optional: Calculate offset dynamically
-        // Scroll with offset to account for sticky navbar
-        const offset = 90;
+        // Calculate offset dynamically based on navbar height
+        const navbar = document.querySelector('nav');
+        const offset = navbar ? navbar.offsetHeight + 10 : 90; // +10 for padding
         const elementTop = element.getBoundingClientRect().top + window.scrollY;
         const targetScroll = elementTop - offset;
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81286fa and 58934bf.

📒 Files selected for processing (3)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx
  • landing-page/src/App.tsx
  • landing-page/src/Pages/Landing page/Navbar.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/components/Navigation/Navbar/Navbar.tsx (1)
frontend/src/constants/routes.ts (1)
  • ROUTES (1-12)
🔇 Additional comments (4)
landing-page/src/App.tsx (1)

18-27: LGTM! Proper anchor target for hash-based navigation.

The addition of id="home" provides the necessary target for the smooth scroll navigation implemented in the landing page Navbar. This change coordinates well with the hash-based navigation links (to="#home") and offset scrolling logic.

landing-page/src/Pages/Landing page/Navbar.tsx (1)

151-151: LGTM! Hash-based navigation aligns with the home anchor.

The change from to="/" to to="#home" with isScrollLink={true} properly implements in-page scrolling that coordinates with the id="home" target added in App.tsx. This provides smooth scrolling without triggering route changes.

frontend/src/components/Navigation/Navbar/Navbar.tsx (2)

25-28: Excellent fix for SPA navigation! Verify route definitions exist.

The replacement of anchor tags with React Router Link components directly addresses the PR objective of preventing full page reloads. The navigation will now stay within the SPA without triggering white flashes.

However, ensure that the routes /home and /settings are properly defined in your routing configuration.

#!/bin/bash
# Search for route definitions to verify /home and /settings routes exist

# Look for Routes/Route components that define 'home' and 'settings' paths
rg -n --type=tsx --type=ts -C5 'path.*["\x27](home|settings)["\x27]' 

# Also check for route definitions using ROUTES constants
rg -n --type=tsx --type=ts -C5 'ROUTES\.(HOME|SETTINGS)'

Also applies to: 87-93


9-9: The import import { Link } from 'react-router' is correct. The frontend package uses React Router v7.6.2, where 'react-router' is the primary package and the correct import source for the Link component. This is consistent with other components in the frontend (e.g., AppSidebar.tsx).

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: Avatar / logo click causes full page reload (white flash) instead of SPA navigation

1 participant