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

Feedback page hydration problem #2828

Closed
slorber opened this issue May 28, 2020 · 0 comments · Fixed by #3269
Closed

Feedback page hydration problem #2828

slorber opened this issue May 28, 2020 · 0 comments · Fixed by #3269
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@slorber
Copy link
Collaborator

slorber commented May 28, 2020

🐛 Bug Report

When accessed directly with a "deep link", there's an hydration problem and the background CSS is not applied properly.

https://v2.docusaurus.io/feedback/p/api-documentation-swagger

This is because we "redirect" from 404.

function NotFound({location}) {
  if (/^\/feedback/.test(location.pathname)) {
    return <Feedback />;
  }
  return <div>404</div>;
}

The problem is that the server-side rendering is the 404 page, and the first client render is the feedback page. It creates a mismatch between the static page and the first react render (see https://joshwcomeau.com/react/the-perils-of-rehydration)

Not sure exactly how to fix this easily in a portable way.

In Gatsby there's the client only routes concept: https://www.gatsbyjs.org/docs/client-only-routes-and-user-authentication/

@slorber slorber added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers v2 and removed status: needs triage This issue has not been triaged by maintainers labels May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant