Skip to content

FIX: Always display error page in Next.js app locally#13900

Merged
amoore108 merged 1 commit intolatestfrom
FIX-always-display-error-page-locally
Apr 10, 2026
Merged

FIX: Always display error page in Next.js app locally#13900
amoore108 merged 1 commit intolatestfrom
FIX-always-display-error-page-locally

Conversation

@amoore108
Copy link
Copy Markdown
Contributor

@amoore108 amoore108 commented Apr 10, 2026

Summary

Small fix to always display an error page if the route being viewed locally is incorrect.

Previously just a blank white page would be displayed for a route that didn't match.

This is just a local development aid, as upstream systems define "valid" routes for the application and return a static 404 page in instances that routes aren't matched.

Testing

  1. Visit:
    http://localhost:7081/foobar
    http://localhost:7081/foobar.amp
    http://localhost:7081/igbo/foobar
    http://localhost:7081/igbo/foobar.amp
  2. Confirm all the links return a 404 error page, with the non-Igbo pages defaulting to English

Useful Links

@amoore108 amoore108 self-assigned this Apr 10, 2026
@amoore108 amoore108 marked this pull request as ready for review April 10, 2026 12:33
Copilot AI review requested due to automatic review settings April 10, 2026 12:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the local developer experience in the ws-nextjs-app Next.js application by ensuring invalid local routes consistently render the standard 404 error page (instead of a blank screen), even when the “service” segment in the URL is not a recognised Simorgh service.

Changes:

  • Validates the service extracted from the URL against the canonical services list and falls back to news when invalid, so the error page can render.
  • Replaces hard-coded 404 values with the shared NOT_FOUND status constant.

@amoore108 amoore108 merged commit 3954ffc into latest Apr 10, 2026
17 checks passed
@amoore108 amoore108 deleted the FIX-always-display-error-page-locally branch April 14, 2026 15:50
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.

4 participants