-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
gatsby-plugin-create-client-paths remounts the root on every page transition #10227
gatsby-plugin-create-client-paths remounts the root on every page transition #10227
Comments
Cc @kkemple |
Context:
There is a way to override this in user code - adding something like this in import React from "react"
export const replaceComponentRenderer = ({ props }) => (
<props.pageResources.component {...props} />
) Will do everything we do in core except for setting This |
Add docs about avoiding request waterfalls with client routes by overriding component renderer `key` prop (gatsbyjs#10227 (comment)) Closes gatsbyjs#10227
This worked. Submitted #10255 which documents the solution. |
Description
gatsby-plugin-create-client-paths
is remounting the root component on every single page transition for the client-only path. This means that if you have auth check in your top-level root, your authentication check will run on each new page instead of just once like it would with a normal React SPA (e.g. one built with create-react-app)Expected result
The root component should only mount once.
Actual result
The root (with routes) is remounted on every single transition.
The text was updated successfully, but these errors were encountered: