Skip to content

[Bug]: Replace standard <a> tags with Next.js <Link> components for internal navigation #1786

@ArshVermaGit

Description

@ArshVermaGit

Description

The application currently uses standard HTML <a> tags for internal routing across several pages instead of the Next.js <Link> component.
This is a Next.js anti-pattern that breaks Single Page Application (SPA) routing. When users click these links, the browser performs a full page reload rather than a fast, client-side navigation. This degrades performance, increases server load, and removes the seamless SPA feel of the dashboard.

Affected Files

Based on ESLint (@next/next/no-html-link-for-pages) warnings, the following files are known to contain this issue:

  • src/app/compare/[users]/page.tsx
  • src/app/dashboard/settings/page.tsx
  • src/app/u/[username]/page.tsx
  • src/components/landing/LandingPage.tsx
    (Note: There may be other files affected. A project-wide search for <a> tags pointing to internal routes should be conducted).

Expected Behavior

Internal navigation should be instantaneous without triggering a full browser refresh, preserving client-side state and offering a smooth, optimized user experience.

Steps to Reproduce

  1. Navigate to the Landing Page, Dashboard Settings, or a Public Profile.
  2. Click on an internal link (e.g., navigating back to the home page / or to an authentication endpoint like /api/auth/signin/github/).
  3. Observe the browser tab reloading the entire page instead of a smooth SPA transition.

Proposed Solution

  1. Identify all instances of standard <a> tags used for internal routes (e.g., routes starting with /).
  2. Import the Next.js Link component: import Link from 'next/link';
  3. Replace the <a> tags with <Link> components, keeping the href attribute intact.
  4. Run npm run lint to verify that the no-html-link-for-pages ESLint warnings have been resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions