-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
"Warning: useLayoutEffect does nothing on the server" appeared since updating to @latest version. #8124
Comments
@zakariamofaddel Thanks for reporting this! Assigning to @brainkim since this looks like a consequence of #8022. |
@zakariamofaddel Sorry about this! I haven’t used React in a while so I jumped on the opportunity for a synchronous effect hook to fix some other weird reactiveVar issues.
Is this something that only appears when you switch versions or could it possibly due to code changes you made as well? |
No worries @brainkim !
I have developed for the past 6 hours, after reverting to @3.3.14, and I haven't encountered any of the issues previously mentioned. No warnings, no mismatches. Even the warning talks about mismatches, I guess it's all connected to that useLayoutEffect...
|
@zakariamofaddel I’m doing some testing and it feels as though the only reason the new |
Thank you for your speed and work, very much appreciated!
I'm always using the hook at the top of my functional components, this way,: But remember that I'm using NextJs' SSG feature on some pages where child components use the useReactiveVar hook. |
Hi, This is my implementation (it's a bit different from the one that is above): import {ApolloClient, InMemoryCache, HttpLink, from} from '@apollo/client'; const errorLink: any = onError(({graphQLErrors, networkError}: any) => { const httpLink = new HttpLink({ const link = from([errorLink, httpLink]); let apolloClient: any; export function createApolloClient() { export function initializeApollo(initialState = null) {
} export function useApollo(initialState) { export * from './queries'; I Hope will be solved soon or find a temp solution at least. |
*If reverting @apollo/client to @3.3.14, warning disappears
I'm extensively using the getStaticProps method by nextJS in my application and everything was running smoothly, but once I did an update of all the packages, I started seeing this annoying warning.
I reverted to a previous commit and updated packages one by one, thinking it was a material-ui problem. But the warning appeared only after updating @apollo/client.
Intended outcome:
Updating packages, from 3.3.14 to @3.3.16.
Actual outcome:
This is the warning I started getting after the update:
And I noticed mismatches started appearing in the console. This is a rehydration problem probably, but it wasn't there before updating...
example mismatch:
My package.json file:
My Apollo Initialization (from zeit/nextjs apollo example) (The APOLLO_STATE_PROP_NAME variable is just a string = "APOLLO_STATE"):
Versions
Run the following command in your project directory, and paste its (automatically copied to clipboard) results here:
npx envinfo@latest --preset apollo --clipboard
:All the additional packages are not used, I'm only using @apollo/client at the moment.
The text was updated successfully, but these errors were encountered: