Skip to content

fix(settings): show the 404 page for unknown /settings routes - #21570

Merged
vbudhram merged 1 commit into
mainfrom
fxa-13040
Oct 21, 2026
Merged

vbudhram merged 1 commit into
mainfrom
fxa-13040

Conversation

@fxa-agent

@fxa-agent fxa-agent Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Because

  • An unknown path such as /settings/no-such-route showed only the empty settings layout, with no 404 page.
  • The Settings <Routes> had no catch-all route.

This pull request

  • Adds a path="*" route in Settings/index.tsx that renders NotFoundRedirect.
  • NotFoundRedirect calls hardNavigate('/404', {}, false, true). The call replaces the history entry, so the back button does not loop.
  • Adds a unit test in Settings/index.test.tsx and a functional test in settings/misc.spec.ts.
  • Existing routes and redirects do not change.
  • When the passkey flags are off, /settings/passkeys/add now shows the 404 page instead of an empty layout.

Issue that this pull request solves

Closes: FXA-13040

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on: packages/fxa-settings/src/components/Settings/index.tsx
  • Suggested review order: the component, then the unit test, then the functional test.
  • Risky or complex parts: the redirect target. See "Other information".

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

fxa-settings has no not-found component. Content-server serves the settings app for every /settings/* path. So the app leaves for /404, which content-server does not serve. Content-server then renders its existing 404 page. The result matches unknown paths outside /settings.

One reviewer decision: is a full-page redirect to /404 acceptable, or do you want a not-found component inside fxa-settings?

Local checks:

  • Unit test leaves the app for the 404 page on an unknown route: PASS. With /fxa-verify --revert, it FAILs without the fix.
  • Functional test unknown settings route shows the 404 page on the local stack: PASS.
  • curl on localhost:3030/404: HTTP 404 with the fxa-404-header page.
  • Lint, Prettier and tsc for fxa-settings: PASS. ESLint and Prettier on misc.spec.ts: PASS.

CI runs the full suites.

settings-misc-severity-2-s-9d9fc-gs-route-shows-the-404-page-local.webm

Because:

- An unknown path under /settings showed the empty Settings layout, not a 404 page.

This commit:

- Adds a catch-all Settings route that replaces the page with /404, which content-server renders as its 404 page.
- Adds a unit test and a functional test for an unknown /settings route.

Closes FXA-13040
@fxa-agent
fxa-agent Bot requested a review from a team as a code owner October 20, 2026 21:01
@fxa-agent fxa-agent Bot added the auto label Oct 20, 2026
@vbudhram
vbudhram requested a lite review from Copilot October 21, 2026 01:35
// Content-server serves this app for every /settings/* path, so leave it for the 404 page.
const NotFoundRedirect = () => {
useEffect(() => {
hardNavigate('/404', {}, false, true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does not hurt for now, we will remove hardNavigate everywhere once Backbone decomission is done

@vbudhram
vbudhram merged commit 6bcf2f4 into main Oct 21, 2026
22 checks passed
@vbudhram
vbudhram deleted the fxa-13040 branch October 21, 2026 01:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Prevent duplicate redirects under React StrictMode.

1 open issue
What changed in this PR

Adds a catch-all Settings route that redirects unknown paths to the content-server 404 page.

Changes:

  • Added NotFoundRedirect and wildcard routing.
  • Added unit and functional tests.
  • A moderate issue remains: guard the redirect effect against duplicate StrictMode navigation.
File Description
packages/​fxa-settings/​src/​components/​Settings/​index.tsx Adds the catch-all 404 redirect.
packages/​fxa-settings/​src/​components/​Settings/​index.test.tsx Tests unknown-route handling.
packages/​functional-tests/​tests/​settings/​misc.spec.ts Verifies the rendered 404 page.

Review effort: Lite

Comment on lines +61 to +66
const NotFoundRedirect = () => {
useEffect(() => {
hardNavigate('/404', {}, false, true);
}, []);
return <LoadingSpinner fullScreen />;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants