New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Hydration failed because the initial UI...
while adding custom 404.mdx
/500.mdx
custom error pages
#607
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we filter error routes at the beginning of normalize-pages
, e.g. here?
nextra/packages/nextra-theme-docs/src/utils/normalize-pages.tsx
Lines 113 to 122 in ef65eff
const items = list | |
.filter( | |
a => | |
// not meta | |
a.name !== 'meta.json' && | |
// not hidden routes | |
!a.name.startsWith('_') && | |
// locale matches, or fallback to default locale | |
(a.locale === locale || a.locale === defaultLocale || !a.locale) | |
) |
case 'gitlab': | ||
return `https://gitlab.com/${repo.owner}/${repo.name}/-/blob/${ | ||
repo.branch || 'master' | ||
}/${repo.subdir || 'pages'}${filepath}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like the previous GitLab issue link never worked.. it should be
nextra/packages/nextra-theme-docs/src/utils/get-git-issue-url.ts
Lines 20 to 23 in 9c7cde3
case 'gitlab': | |
return `https://gitlab.com/${repo.owner}/${ | |
repo.name | |
}/-/issues/new?issue[title]=${encodeURIComponent(title)}` |
you were right, I found a better place! Let me know what do you think ;) https://nextra-theme-docs-rbfdnx0wf.vercel.sh/docs/404-500#500 |
@@ -147,20 +145,17 @@ interface SeparatorProps { | |||
topLevel: boolean | |||
} | |||
|
|||
function Separator({ title, topLevel }: SeparatorProps) { | |||
const hasTitle = title !== undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Herr I'm using !== undefined
check because title can be an empty string ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shuding turned back, added small comment also
notFoundLink() { | ||
const config = useConfig() | ||
const mounted = useMounted() | ||
const { asPath } = useRouter() | ||
return ( | ||
<Anchor | ||
href={getGitIssueUrl({ | ||
repository: config.docsRepositoryBase, | ||
title: `Found broken \`${mounted ? asPath : ''}\` link. Please fix!`, | ||
labels: config.notFoundLabels | ||
})} | ||
newWindow | ||
> | ||
Submit an issue about broken link. | ||
</Anchor> | ||
) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…`404.mdx`/`500.mdx` custom error pages (#607) * fix * even yet better! * remove unused things * fix hasTitle * move notFoundLink and serverSideErrorLink directly to components
* fix `next export` command * replace `classnames` package with `clsx` as he's faster (#656) * remove `locale` prop from theme config, forbid passing `locale` prop in `renderComponent()` (#658) * remove `locale` prop from theme config, forbid passing in `renderComponent` * fix ci * fix `Warning: Prop `href` did not match. Server: "#" Client: ...` (#659) * update snapshots * update tests * fix `Hydration failed because the initial UI...` while adding custom `404.mdx`/`500.mdx` custom error pages (#607) * fix * even yet better! * remove unused things * fix hasTitle * move notFoundLink and serverSideErrorLink directly to components * rebase fixes * fix type check
* fix `next export` command * replace `classnames` package with `clsx` as he's faster (shuding#656) * remove `locale` prop from theme config, forbid passing `locale` prop in `renderComponent()` (shuding#658) * remove `locale` prop from theme config, forbid passing in `renderComponent` * fix ci * fix `Warning: Prop `href` did not match. Server: "#" Client: ...` (shuding#659) * update snapshots * update tests * fix `Hydration failed because the initial UI...` while adding custom `404.mdx`/`500.mdx` custom error pages (shuding#607) * fix * even yet better! * remove unused things * fix hasTitle * move notFoundLink and serverSideErrorLink directly to components * rebase fixes * fix type check
related #603
update:swr-site build
locally pass, can I have an error, please?