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

Material-UI v4 display warnings when used with next-with-apollo #60

Closed
ralvs opened this issue May 30, 2019 · 8 comments
Closed

Material-UI v4 display warnings when used with next-with-apollo #60

ralvs opened this issue May 30, 2019 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@ralvs
Copy link

ralvs commented May 30, 2019

Related issue at MUI repository: #15798

After update to Material-UI v4.0, lots of warnings started to show at DevTools.
If I remove next-with-apollo and follow the example with-apollo-auth, everything works fine.

@eps1lon
Copy link

eps1lon commented May 31, 2019

Issue is likely caused by bundling a polyfill which relies on the window object. window should be undefined on the server IMO.

@lfades lfades added the bug Something isn't working label May 31, 2019
@lfades lfades self-assigned this May 31, 2019
@oliviertassinari
Copy link
Contributor

oliviertassinari commented Jun 3, 2019

I believe we have identified the source of the problem:
mui/material-ui#15798 (comment)

@ivawzh
Copy link

ivawzh commented Jun 6, 2019

Also after I set withApollo(..., { getDataFromTree: 'never' }) and new ApolloClient({ ssrMode: false, ... }), the warnings still persist.

@oliviertassinari
Copy link
Contributor

@ivawzh I have experienced the opposite. It solves the warning in the reproduction provided on Material-UI side.

@ghost ghost mentioned this issue Jul 25, 2019
@ghost
Copy link

ghost commented Jul 25, 2019

Im experiencing the same as here, setting withApollo(..., { getDataFromTree: 'never' }) has no impact on the warnings.
Following the next repository example does not exhibit this error. Ill continue to dig into the differences, but there is an incompatibility between this library and material-ui currently.

Update: @oliviertassinari solution did actually work for me in the end - which makes sense because the example wraps getDataFromTree in a SSR only test whereas this library defaults to client and server.
You have to be very careful where you place the option value. I had it in the wrong place.

@lfades would it make more sense to default getDataFromTree as SSR only? Since the client instance is reused - im not sure why its defaulted to always.

@nicovalencia
Copy link

Make sure you're getting what you're expecting from the re-render, but if you're looking for the happy path SSR hydration, this should work:

export default withApollo(createClient, { getDataFromTree: 'ssr' });

@wesbos
Copy link
Contributor

wesbos commented Jan 28, 2020

This can be closed

@lfades lfades closed this as completed Jan 28, 2020
@vitaliemiron
Copy link

now withApollo function have another interface, can you post please new example how to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants