Core 2238: Restore navigation to 404 page#2875
Conversation
| }); | ||
| const {layoutParameters, setLayoutParameters} = useLayoutContext(); | ||
|
|
||
| if (layoutParameters.name === null) { |
There was a problem hiding this comment.
won't this make loading a 404 page in a portal flash the main nav while the page data is loading?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| const {layoutParameters, setLayoutParameters} = useLayoutContext(); | ||
|
|
||
| if (layoutParameters.name === null) { | ||
| setLayoutParameters(); | ||
| } |
| <LayoutContextProvider> | ||
| <LoadedPage data={data} Child={Child} props={{}} /> | ||
| </LayoutContextProvider> | ||
| </MemoryRouter> | ||
| ); |
CORE-2238