Skip to content

Commit

Permalink
Fix hydration error on ResourcePage
Browse files Browse the repository at this point in the history
This was fixed by using responseContext to determine whether or not to
render an `AccessDeniedError`.

This feels fairly fragile, but not sure how it can be improved as long
as errors aren't passed with the graphql cache from server to client.
  • Loading branch information
jnatten committed Nov 14, 2024
1 parent 711ce65 commit e53db5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/containers/ResourcePage/ResourcePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ const ResourcePage = () => {
}

const accessDeniedErrors = findAccessDeniedErrors(error);
if (accessDeniedErrors) {
if (accessDeniedErrors || responseContext?.isAccessDeniedError()) {
const nonRecoverableError = accessDeniedErrors.some(
(e) => !e.path?.includes("coreResources") && !e.path?.includes("supplementaryResources"),
);

if (nonRecoverableError) {
if (nonRecoverableError || responseContext?.isAccessDeniedError()) {
return <AccessDeniedPage />;
}
}
Expand Down

0 comments on commit e53db5b

Please sign in to comment.