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

[2.4.0-beta.0] Breaks react-query devtools (React context change?) #4005

Closed
6 tasks done
IanVS opened this issue Jun 28, 2021 · 3 comments · Fixed by #4019
Closed
6 tasks done

[2.4.0-beta.0] Breaks react-query devtools (React context change?) #4005

IanVS opened this issue Jun 28, 2021 · 3 comments · Fixed by #4019

Comments

@IanVS
Copy link
Contributor

IanVS commented Jun 28, 2021

Describe the bug

I attempted to upgrade my app to vite 2.4.0-beta.0, but now I get the error:

Uncaught Error: No QueryClient set, use QueryClientProvider to set one
    at useQueryClient2 (QueryClientProvider.js:36)
    at ReactQueryDevtoolsPanel2 (devtools.js:287)
    at renderWithHooks (react-dom.development.js:14985)
    at updateForwardRef (react-dom.development.js:17044)
    at beginWork (react-dom.development.js:19098)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at beginWork$1 (react-dom.development.js:23964)
    at performUnitOfWork (react-dom.development.js:22776)

The above error occurred in the <ForwardRef(ReactQueryDevtoolsPanel2)> component:

    at ReactQueryDevtoolsPanel2 (http://localhost:8080/node_modules/.cache/vite/react-query_devtools.js?v=7bc19b7b:4736:26)
    at ThemeProvider (http://localhost:8080/node_modules/.cache/vite/react-query_devtools.js?v=7bc19b7b:4013:24)
    at footer
    at ReactQueryDevtools (http://localhost:8080/node_modules/.cache/vite/react-query_devtools.js?v=7bc19b7b:4547:32)
    at QueryClientProvider2 (http://localhost:8080/node_modules/.cache/vite/react-query.js?v=7bc19b7b:2438:21)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.

I verified that downgrading to vite 2.3.8 resolves the error, and have created a minimal reproduction.

Reproduction

https://github.com/IanVS/vite-2.4.0-react-query-issue

System Info

System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 29.71 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v14.16.1/bin/yarn
    npm: 7.17.0 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Browsers:
    Brave Browser: 91.1.26.67
    Firefox: 88.0.1
    Safari: 14.1.1
  npmPackages:
    vite: ^2.4.0-beta.0 => 2.4.0-beta.0

Used Package Manager

npm

Logs

No response

Validations

@IanVS
Copy link
Contributor Author

IanVS commented Jun 29, 2021

Through the use of git bisect and using one of the playgrounds in this repo to reproduce the issue, I've narrowed down the start of the error to #3753.

@IanVS
Copy link
Contributor Author

IanVS commented Jun 29, 2021

I did a little more digging, and it seems that before the change in the PR I referenced, react-query from within node_modules/react-query/es/devtools would resolve to /node_modules/react-query/es/index.js, now, with those changes, it resolves to node_modules/react-query/lib/index.js. That seems to be the cause of the issue I'm seeing.

@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2021
aleclarson pushed a commit to aleclarson/vite that referenced this issue Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant