Skip to content

Conversation

@garvitsingh171
Copy link
Contributor

@garvitsingh171 garvitsingh171 commented Nov 29, 2025

Description

This PR fixes the confusing behavior described in issue #4896 where navigating to a non-existent record URL loads a blank record form with an “Unsaved Changes” badge instead of an error page. Now, when the requested record does not exist, the user sees a clear “Record not found” error page that matches the existing schema error page in layout and tone.

This PR completes the following tasks:

  • Detect when loading a record fails via the RecordStore fetch request state.
  • Replace the blank record form with a dedicated “Record not found” error view when the fetch state is failure.
  • Use design-system CSS variables so the error view looks correct in both light and dark themes.
  • Provide a “Go to homepage” button so users can easily navigate away from the error state.
  • Internationalize all new text (“Error”, “Record not found.”, “Go to homepage”) via svelte-i18n and add the corresponding keys to the English dictionary.

Screenshots

Before: non-existent record URL shows an empty record form with an “Unsaved Changes” badge.

image

After: non-existent record URL shows a centered “Error / Record not found.” message and a green “Go to homepage” button.

image

What works

  • Loading an existing record still shows the normal record page.
  • Navigating to any non-existent record ID shows the new “Record not found” error page instead of a blank form.
  • “Go to homepage” button navigates back without leaving the user stuck.
  • Error page respects light and dark themes via existing CSS variables.
  • No new console errors are introduced.

What doesn’t (by design)

  • This PR only changes behavior for invalid record IDs; it does not change schema/table error handling.
  • No new behavior for backend 5xx errors; they continue to be handled as before.

Checklist

  • - My pull request has a descriptive title (not a vague title like “Update index.md”).
  • - My pull request targets the develop branch of the repository.
  • - My commit messages follow best practices.
  • - My code follows the established code style of the repository.
  • - I added tests or performed thorough manual testing for the changes I made (where applicable).
  • - I ran npm run lint, npm run check-format, npm test, and npx tsc --noEmit in mathesar_ui.
  • - I tried running the project locally and verified that there are no visible errors.

Related issue

Fixes #4896

@garvitsingh171 garvitsingh171 changed the title Fix issue 4896 Fix: Display error page for non-existent records instead of blank form (fixes #4896) Nov 29, 2025
@Anish9901
Copy link
Member

Hey @garvitsingh171, Thanks for the PR, can you post some screenshots/video of how your changes look within the app?

Also, please adhere to our PR templates for PR descriptions.

@Anish9901 Anish9901 marked this pull request as draft December 1, 2025 10:22
@garvitsingh171
Copy link
Contributor Author

garvitsingh171 commented Dec 1, 2025

Hey @Anish9901
Here are screenshots of my changes:

Screenshot From 2025-12-01 17-59-23

This is how Mathesar App behave when we land to an anonymous record ID, which was not existing. You can see above in in the URL the dummy 99999999 added by me.

Screenshot From 2025-12-01 17-59-53

After my change to code-base, I have added and error record not found page, which was asked to do.

Sorry my PR didn't match the required PR Templates. I will keep this in check from next time.

@Anish9901
Copy link
Member

@garvitsingh171 The screenshots look good!

Sorry my PR didn't match the required PR Templates. I will keep this in check from next time.

Please edit the description within this PR itself, we won't merge any PRs that don't adhere to our PR template.

@garvitsingh171
Copy link
Contributor Author

Hey! @Anish9901,
I have edited the PR Description to match with PR template.

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.

Confusing behavior when loading the record page for a non-existent record

2 participants