Skip to content
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

Merged
merged 5 commits into from Aug 9, 2022

Conversation

dimaMachina
Copy link
Collaborator

@dimaMachina dimaMachina commented Jul 28, 2022

related #603

update: swr-site build locally pass, can I have an error, please?

@changeset-bot
Copy link

changeset-bot bot commented Jul 28, 2022

⚠️ No Changeset found

Latest commit: 6c68df2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Jul 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nextra-theme-docs-dev ✅ Ready (Inspect) Visit Preview Aug 9, 2022 at 9:20AM (UTC)
1 Ignored Deployment
Name Status Preview Updated
nextra ⬜️ Ignored (Inspect) Aug 9, 2022 at 9:20AM (UTC)

@shuding

This comment was marked as resolved.

Copy link
Owner

@shuding shuding left a 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?

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)
)

Comment on lines -48 to -51
case 'gitlab':
return `https://gitlab.com/${repo.owner}/${repo.name}/-/blob/${
repo.branch || 'master'
}/${repo.subdir || 'pages'}${filepath}`
Copy link
Collaborator Author

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

case 'gitlab':
return `https://gitlab.com/${repo.owner}/${
repo.name
}/-/issues/new?issue[title]=${encodeURIComponent(title)}`

@dimaMachina
Copy link
Collaborator Author

dimaMachina commented Aug 8, 2022

Can we filter error routes at the beginning of normalize-pages, e.g. here?

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)
)

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

@dimaMachina dimaMachina marked this pull request as ready for review August 8, 2022 11:21
@@ -147,20 +145,17 @@ interface SeparatorProps {
topLevel: boolean
}

function Separator({ title, topLevel }: SeparatorProps) {
const hasTitle = title !== undefined
Copy link
Owner

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 ''

Copy link
Collaborator Author

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

Comment on lines 63 to 79
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>
)
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think a need to move <Anchor /> directly in <NotFoundPage />, same for <Anchor /> in serverSideErrorLink

Because in feedbackLink it's a child of <Anchor/>
image

Copy link
Owner

@shuding shuding left a comment

Choose a reason for hiding this comment

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

Thanks!

@dimaMachina dimaMachina merged commit b397aa1 into fix-next-export Aug 9, 2022
@dimaMachina dimaMachina deleted the 404-500 branch August 9, 2022 09:22
dimaMachina added a commit that referenced this pull request Aug 9, 2022
…`404.mdx`/`500.mdx` custom error pages (#607)

* fix

* even yet better!

* remove unused things

* fix hasTitle

* move notFoundLink and serverSideErrorLink directly to components
dimaMachina added a commit that referenced this pull request Aug 9, 2022
* 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
tatukoivisto pushed a commit to tatukoivisto/nextra that referenced this pull request Aug 20, 2023
* 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
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.

None yet

2 participants