query: Error Coming from ReactQueryDevTools: "Warning: Prop `style` did not match."

Bug Description: After upgrading to React Query 3 with built in dev tools, I am getting an error in my browser console every time I hard refresh my application. I tried removing the <ReactQueryDevTools initialIsOpen /> component from my _app.js file and the error was no longer showing. The error is showing in every browser I tried. I am using Next.js for what it’s worth.

Here’s the error I am getting: Screen Shot 2021-02-10 at 10 02 46 AM

And here’s the stack trace below the error: Screen Shot 2021-02-10 at 10 03 29 AM

Here’s my _app.js:

import { ReactQueryDevtools } from "react-query/devtools"
import { QueryClient, QueryClientProvider } from "react-query"

const queryClient = new QueryClient()

export default function App({ Component, pageProps }) {
    return (
        <QueryClientProvider client={queryClient}>
            <Component {...pageProps} />
            <ReactQueryDevtools initialIsOpen />
        </QueryClientProvider>
    )
}

Versions:

  • React Query Version: 3.5.11
  • React Version: 16.13.1
  • Next.js Version: 10.0.3

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@TkDodo Hmm. Was there a regression with this? I’m still experiencing this issue. Just tried upgrading from 2.4.7 to 3.8.3. Our _app.js is a little more complicated but the provider is still at the the top of the tree. looks like the first style is the only difference.

Warning: Prop `style` did not match.
Server: "display:inline-block;font-size:.9em;font-family:sans-serif;font-weight:normal;line-height:1.3;padding:.3em 1.5em .3em .5em;height:auto;border:0;border-radius:.2em;appearance:none;-webkit-appearance:none;background-color:#fff;background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\");background-repeat:no-repeat;background-position:right .55em center;background-size:.65em auto, 100%;color:#000;flex:1;min-width:75px;margin-right:.5rem"
Client: "display:none;font-size:.9em;font-family:sans-serif;font-weight:normal;line-height:1.3;padding:.3em 1.5em .3em .5em;height:auto;border:0;border-radius:.2em;appearance:none;-webkit-appearance:none;background-color:#fff;background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\");background-repeat:no-repeat;background-position:right .55em center;background-size:.65em auto, 100%;color:#000;flex:1;min-width:75px;margin-right:.5rem"

edit: adding sandbox link. forked from the nextjs example repo for styled-components. page doesn’t render with devtools active, comment it out and it will show the page content properly https://codesandbox.io/s/stoic-kapitsa-wz1nb?file=/pages/_app.js

@UNLRN You’re not supposed to be nesting anything in <ReactQueryDevTools />. Do it like this instead:

<QueryClientProvider client={client}>
  <GlobalStyle />
  <ThemeProvider theme={theme}>
    <Component {...pageProps} />
  </ThemeProvider>
  <ReactQueryDevtools />
</QueryClientProvider>

I’m also seeing the hydration warning when using ReactQueryDevtools (react-query version 3.6.0) in a Next.js application:

Warning: Prop `style` did not match. Server: "display:inline-block;font-size:.9em;font-family:sans-serif;font-weight:normal;line-height:1.3;padding:.3em 1.5em .3em .5em;height:auto;border:0;border-radius:.2em;appearance:none;-webkit-appearance:none;background-color:#fff;background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\");background-repeat:no-repeat;background-position:right .55em center;background-size:.65em auto, 100%;color:#000;flex:1;min-width:75px;margin-right:.5rem" Client: "display:none;font-size:.9em;font-family:sans-serif;font-weight:normal;line-height:1.3;padding:.3em 1.5em .3em .5em;height:auto;border:0;border-radius:.2em;appearance:none;-webkit-appearance:none;background-color:#fff;background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\");background-repeat:no-repeat;background-position:right .55em center;background-size:.65em auto, 100%;color:#000;flex:1;min-width:75px;margin-right:.5rem"
    at select
    at eval (webpack-internal:///./node_modules/react-query/es/devtools/utils.js:36:22)
    at div
    at div
    at div
    at div
    at div
    at eval (webpack-internal:///./node_modules/react-query/es/devtools/utils.js:36:22)
    at ThemeProvider (webpack-internal:///./node_modules/react-query/es/devtools/theme.js:14:20)
    at ReactQueryDevtoolsPanel (webpack-internal:///./node_modules/react-query/es/devtools/devtools.js:261:25)
    at ThemeProvider (webpack-internal:///./node_modules/react-query/es/devtools/theme.js:14:20)
    at footer
    at ReactQueryDevtools (webpack-internal:///./node_modules/react-query/es/devtools/devtools.js:44:28)
    at QueryClientProvider (webpack-internal:///./node_modules/react-query/es/react/QueryClientProvider.js:36:22)
    at ErrorBoundary (webpack-internal:///./node_modules/react-storefront/ErrorBoundary.js:47:37)
    at LinkContextProvider (webpack-internal:///./node_modules/react-storefront/link/LinkContextProvider.js:22:23)
    at PWA (webpack-internal:///./node_modules/react-storefront/PWA.js:55:23)
    at MyApp (webpack-internal:///./pages/_app.js:85:24)
    at ErrorBoundary (webpack-internal:///./node_modules/@next/react-dev-overlay/lib/internal/ErrorBoundary.js:23:47)
    at ReactDevOverlay (webpack-internal:///./node_modules/@next/react-dev-overlay/lib/internal/ReactDevOverlay.js:73:23)
    at Container (webpack-internal:///./node_modules/next/dist/client/index.js:150:5)
    at AppContainer (webpack-internal:///./node_modules/next/dist/client/index.js:639:24)
    at Root (webpack-internal:///./node_modules/next/dist/client/index.js:764:24)

For anyone else having this same warning - for me it only occurs after a full page reload AND if the screen width is less than 500px. I believe this is the cause: https://github.com/tannerlinsley/react-query/blob/master/src/devtools/styledComponents.ts#L103

This issue can be closed 👍 Fixed in 3.21.1.

I’m also getting the warning on a full page reload on mobile on 3.21.0. This issue should be re-opened 😃

Alright, I’ll give it a shot 😃

hmm, we had an issue like that recently: https://github.com/tannerlinsley/react-query/issues/1543

and it was fixed here: https://github.com/tannerlinsley/react-query/pull/1613

which was released in 3.5.14. The issue states you are on 3.5.11 - can you try upgrading please?