docs icon indicating copy to clipboard operation
docs copied to clipboard

fix: fixing the redirection to /docs

Open Iam-Karan-Suresh opened this issue 2 months ago • 1 comments

Title

Refactor NotFound component to use window.location.replace for immediate redirect


What has changed?

This PR updates the NotFound component to use window.location.replace("/docs") instead of rendering a fallback route.
This ensures users are immediately redirected to the /docs page when accessing a non-existent route, without adding a new entry to the browser history.


Why this change?

Using window.location.replace provides a cleaner redirect behavior for documentation routes:

  • Prevents unnecessary browser history entries.
  • Improves user navigation experience.
  • Keeps the redirect logic simple and efficient.

Type of change

  • [x] Refactor / Code improvement
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation update

How has this been tested?

  1. Ran the build command:
    npm run build
    npm run serve
    
  2. Navigated to a non-existent route (e.g., /random) and verified that it immediately redirects to /docs.
  3. Confirmed that no extra entry is added in browser history and that navigation behaves as expected.

Checklist

  • [x] My code follows the style guidelines of this project.
  • [x] I have performed a self-review of my own code.
  • [x] My commits are properly signed off with DCO compliance.
  • [x] Verified that redirects work correctly in build mode.

https://github.com/user-attachments/assets/82cd5579-732e-45b5-ba23-6fe06803260a

Additional context

This change improves user experience on broken or outdated links by ensuring seamless redirection to the docs homepage.

Iam-Karan-Suresh avatar Nov 07 '25 05:11 Iam-Karan-Suresh