question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integration of new Server Rendering API

See original GitHub issue

I was using Material UI with Apollo and Next.js. Previously I use the StylesProvider for the rendering in App Component. I pass disableGeneration as true to StyleProvider to perform Apollo Server-side rendering.

I found that the new guide has been changed to ServerStyleSheet. StylesProvider has been changed to sheets.collect. I think it is not great to new a ServerStyleSheet and pass sheets.collect to App Component render function. I see the latest example use the ServerStyleSheet in the document.tsx instead of app.tsx.

If I do so, how could I pass disableGeneration during Apollo Server-side rendering? Do I need two ServerStyleSheet instance? If not, how to do that?

And could the nextjs example be enhanced that we could dynamically change the theme color on client-side? I think it is a very common use-case, but its a bit tricky as we have to share the theme color in a memoized context.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
heysailorcommented, Apr 10, 2019

I made repo that uses the new API, including disableGeneration when using Apollo’s getDataFromTree: https://github.com/heysailor/material-ui-nextjs

0reactions
oliviertassinaricommented, Apr 10, 2019

The StylesProvider won’t be deprecated. The sheet manager and collector are no longer documentation. These two objets are now considered internals. As long as it’s documented, you are good.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integration of new Server Rendering API · Issue #15277 - GitHub
I was using Material UI with Apollo and Next.js. Previously I use the StylesProvider for the rendering in App Component.
Read more >
Server-side rendering - Apollo GraphQL Docs
Server -side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw...
Read more >
Server-side API integration - Optimizely
Server -side API integration. This topic describes how to integrate the Product Recommendations server-side API for an Optimizely-based website.
Read more >
Server-Side Rendering - Vite
Vite provides built-in support for server-side rendering (SSR). The Vite playground contains example SSR setups for Vue 3 and React, which can be...
Read more >
Server-side rendering JSS apps in integrated mode
When running the JSS app in integrated mode, a Node.js server renders the JSS application before providing it to the client.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found