Skip to content

Core 2238: Restore navigation to 404 page#2875

Open
RoyEJohnson wants to merge 2 commits into
mainfrom
core-2238-add-homepage-link-to-404-page
Open

Core 2238: Restore navigation to 404 page#2875
RoyEJohnson wants to merge 2 commits into
mainfrom
core-2238-add-homepage-link-to-404-page

Conversation

@RoyEJohnson
Copy link
Copy Markdown
Contributor

@RoyEJohnson RoyEJohnson commented May 26, 2026

@RoyEJohnson RoyEJohnson requested a review from TomWoodward May 26, 2026 22:34
Comment thread src/app/pages/404/404.tsx
});
const {layoutParameters, setLayoutParameters} = useLayoutContext();

if (layoutParameters.name === null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

won't this make loading a 404 page in a portal flash the main nav while the page data is loading?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not that I can see. A top-level portal page won't do a 404 because it has to exist in the CMS to be a portal page. A lower-level page within the portal doesn't load until the layout parameters are set, so this if condition isn't met.

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

Restores consistent site navigation on the 404 page by ensuring the default layout is applied when the app lands in an “unset layout” state, and updates the loader-page test setup to provide the layout context needed by the 404 component.

Changes:

  • Initialize layout parameters for the 404 page via the layout context so the default layout (and navigation) can render.
  • Wrap the loader-page error-path test render with LayoutContextProvider.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/src/components/loader-page.test.tsx Wraps the test render in LayoutContextProvider so rendering the 404 path has required context.
src/app/pages/404/404.tsx Uses layout context to trigger default layout selection when the layout is currently unset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/pages/404/404.tsx
Comment on lines +10 to +14
const {layoutParameters, setLayoutParameters} = useLayoutContext();

if (layoutParameters.name === null) {
setLayoutParameters();
}
Comment on lines +17 to 21
<LayoutContextProvider>
<LoadedPage data={data} Child={Child} props={{}} />
</LayoutContextProvider>
</MemoryRouter>
);
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.

3 participants