Skip to content

Commit 260b2b2

Browse files
authored
fix: 404 template shows error page (#6441)
1 parent a3201bd commit 260b2b2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

site/src/components/TemplateLayout/TemplateLayout.tsx

+17-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Permissions } from "xServices/auth/authXService"
1414
import { Loader } from "components/Loader/Loader"
1515
import { usePermissions } from "hooks/usePermissions"
1616
import { TemplatePageHeader } from "./TemplatePageHeader"
17+
import { AlertBanner } from "components/AlertBanner/AlertBanner"
1718

1819
const useTemplateName = () => {
1920
const { template } = useParams()
@@ -57,9 +58,21 @@ export const TemplateLayout: FC<{ children?: JSX.Element }> = ({
5758
organizationId,
5859
},
5960
})
60-
const { template, permissions: templatePermissions } = templateState.context
61+
const {
62+
template,
63+
permissions: templatePermissions,
64+
getTemplateError,
65+
} = templateState.context
6166
const permissions = usePermissions()
6267

68+
if (getTemplateError) {
69+
return (
70+
<div className={styles.error}>
71+
<AlertBanner severity="error" error={getTemplateError} />
72+
</div>
73+
)
74+
}
75+
6376
if (!template || !templatePermissions) {
6477
return <Loader />
6578
}
@@ -117,6 +130,9 @@ export const TemplateLayout: FC<{ children?: JSX.Element }> = ({
117130

118131
export const useStyles = makeStyles((theme) => {
119132
return {
133+
error: {
134+
margin: theme.spacing(2),
135+
},
120136
tabs: {
121137
borderBottom: `1px solid ${theme.palette.divider}`,
122138
marginBottom: theme.spacing(5),

0 commit comments

Comments
 (0)