next-sanity
next-sanity copied to clipboard
Upgrading to v8 of next-sanity causes multiple renderers concurrently rendering the same context provider warning
Describe the bug
I just upgraded to next-sanity@8 and experienced the following warning in my terminal
Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.
at ToastProvider (webpack-internal:///(ssr)/./node_modules/sanity/node_modules/@sanity/ui/dist/index.esm.js:7764:13)
at tt (webpack-internal:///(ssr)/./node_modules/styled-components/dist/styled-components.esm.js:698:58)
at ThemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/node_modules/@sanity/ui/dist/index.esm.js:1043:74)
at ColorThemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/_internalBrowser-g8TrRAj2.js:46082:11)
at ColorSchemeLocalStorageProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/_internalBrowser-g8TrRAj2.js:46107:11)
at ColorSchemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/_internalBrowser-g8TrRAj2.js:46093:11)
at StudioProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/_internalBrowser-g8TrRAj2.js:54556:11)
at Studio (webpack-internal:///(ssr)/./node_modules/sanity/lib/index.esm.js:3132:13)
at div
at eval (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/NextStudioLayout.js:9:82)
at Le (webpack-internal:///(ssr)/./node_modules/styled-components/dist/styled-components.esm.js:544:63)
at c (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/registry.js:13:24)
at eval (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/NextStudio.js:17:82)
at Studio
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:76:9)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at body
at html
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at ReactDevOverlay (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/internal/ReactDevOverlay.js:84:9)
at HotReload (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/hot-reloader-client.js:308:11)
at Router (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:176:11)
at ErrorBoundaryHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:113:9)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at AppRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:515:13)
at Lazy
at Lazy
at rS (/Users/jamessingleton/Code/City of Maricopa Projects/coparesources/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:15614)
at rS (/Users/jamessingleton/Code/City of Maricopa Projects/coparesources/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:15614)
at ServerInsertedHTMLProvider (/Users/jamessingleton/Code/City of Maricopa Projects/coparesources/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:21176)
To Reproduce
Steps to reproduce the behavior:
- Update a next.js app with embedded studio to v8 of
next-sanity - Follow this setup: https://github.com/sanity-io/next-sanity?tab=readme-ov-file#studio-route-with-app-router
- Load the studio
- See error in terminal
Expected behavior
I should not be getting this warning
Screenshots If applicable, add screenshots to help explain your problem.
Which versions of Sanity are you using?
@sanity/cli (global) 3.29.0 (up to date)
@sanity/image-url 1.0.2 (up to date)
@sanity/vision 3.29.0 (up to date)
sanity 3.29.0 (up to date)
What operating system are you using?
MacOS
Which versions of Node.js / npm are you running?
9.8.1
v18.18.2
Additional context
Reverting back to v7.1.4 of next-sanity I no longer get that issue
I'm not able to reproduce this message.
Feel free to fork https://github.com/sanity-io/template-nextjs-personal-website and alter it until you can reproduce the warning there.
I just bumped all its dependencies and regenerated the lockfile. Then I:
next dev
Opened http://localhost:3000/studio
No warnings 🤷
Also got this upon upgrading to v8. Reverting no longer showed the error.
I've also gotten this error.
It would be helpful with a reproduction repository we could dive into and investigate. Until then we're going to have to give priority to other issues that have repros as we can't justify spending an unknown amount of time trying to reverse engineer reports. We already followed the OP instructions and did not see the warning.
@stipsan what is odd is I just upgraded another repo to v8 and didn't get it, but then I refreshed since I hadn't refreshed since deleting the loading.tsx file. Once I refreshed I got
Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.
at ThemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/node_modules/@sanity/ui/dist/index.esm.js:1043:74)
at ColorThemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:45977:11)
at ColorSchemeLocalStorageProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:46002:11)
at ColorSchemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:45988:11)
at StudioProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:54468:11)
at Studio (webpack-internal:///(ssr)/./node_modules/sanity/lib/index.esm.js:3134:13)
at div
at eval (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/NextStudioLayout.js:9:82)
at fe (webpack-internal:///(ssr)/./node_modules/styled-components/dist/styled-components.esm.js:387:63)
at c (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/registry.js:13:24)
at eval (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/NextStudio.js:17:82)
at Studio
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:76:9)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at body
at html
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at ReactDevOverlay (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/internal/ReactDevOverlay.js:84:9)
at HotReload (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/hot-reloader-client.js:308:11)
at Router (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:176:11)
at ErrorBoundaryHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:113:9)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at AppRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:515:13)
at Lazy
at Lazy
at rS (/Users/jamessingleton/Code/Projects/redshirt-sports/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:15614)
at rS (/Users/jamessingleton/Code/Projects/redshirt-sports/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:15614)
at ServerInsertedHTMLProvider (/Users/jamessingleton/Code/Projects/redshirt-sports/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:21176)
Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.
at ToastProvider (webpack-internal:///(ssr)/./node_modules/sanity/node_modules/@sanity/ui/dist/index.esm.js:7764:13)
at Ge (webpack-internal:///(ssr)/./node_modules/styled-components/dist/styled-components.esm.js:525:62)
at ThemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/node_modules/@sanity/ui/dist/index.esm.js:1043:74)
at ColorThemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:45977:11)
at ColorSchemeLocalStorageProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:46002:11)
at ColorSchemeProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:45988:11)
at StudioProvider (webpack-internal:///(ssr)/./node_modules/sanity/lib/_chunks/TransformPatches--weJct_U.js:54468:11)
at Studio (webpack-internal:///(ssr)/./node_modules/sanity/lib/index.esm.js:3134:13)
at div
at eval (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/NextStudioLayout.js:9:82)
at fe (webpack-internal:///(ssr)/./node_modules/styled-components/dist/styled-components.esm.js:387:63)
at c (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/registry.js:13:24)
at eval (webpack-internal:///(ssr)/./node_modules/next-sanity/dist/studio/NextStudio.js:17:82)
at Studio
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:241:11)
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at NotFoundErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:76:9)
at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11)
at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:333:11)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:152:9)
at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:227:11)
at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44)
at Lazy
at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:351:11)
at Lazy
at body
at html
at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
at ReactDevOverlay (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/internal/ReactDevOverlay.js:84:9)
at HotReload (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/hot-reloader-client.js:308:11)
at Router (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:176:11)
at ErrorBoundaryHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:113:9)
at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:159:11)
at AppRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:515:13)
at Lazy
at Lazy
at rS (/Users/jamessingleton/Code/Projects/redshirt-sports/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:15614)
at rS (/Users/jamessingleton/Code/Projects/redshirt-sports/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:15614)
at ServerInsertedHTMLProvider (/Users/jamessingleton/Code/Projects/redshirt-sports/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:21176)
What is the best way to get something for reproducing, is that template already connected to a studio somehow or will I need to create a studio for it?
What is the best way to get something for reproducing, is that template already connected to a studio somehow or will I need to create a studio for it?
Fastest way is to follow the deploy flow, this will quickly create a clean new project and dataset for you that you can trash afterwards, as well as a github repo that we can quickly clone and test on.
You then find a way to consistently reproduce the warning you're seeing. Maybe you need to change sanity.config.ts or use different versions of dependencies.
That's what we try to do when error reports don't have a lot of information. But that's incredibly time consuming and if we do that for everyone we'd get nothing done 😅