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

[BUG] useUpdate __privateGet(...).defaultMutationOptions is not a function #6433

Closed
daxaxelrod opened this issue Oct 26, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@daxaxelrod
Copy link

Describe the bug

Using a simple useUpdate in a of a model and have recently started getting: __privateGet(...).defaultMutationOptions is not a function and it crashes the whole page. Here's the whole callstack

Uncaught TypeError: __privateGet(...).defaultMutationOptions is not a function
at _a10.setOptions (chunk-JBUGR5HP.js?v=2759a9d4:5823:49)
at new _a10 (chunk-JBUGR5HP.js?v=2759a9d4:5812:10)
at chunk-JBUGR5HP.js?v=2759a9d4:6082:11
at mountState (chunk-2CEY6BTP.js?v=2759a9d4:12025:28)
at Object.useState (chunk-2CEY6BTP.js?v=2759a9d4:12565:24)
at Object.useState (chunk-BK6ZY4NC.js?v=2759a9d4:1066:29)
at useMutation (chunk-JBUGR5HP.js?v=2759a9d4:6081:30)
at useLog (chunk-JBUGR5HP.js?v=2759a9d4:9540:347)
at useUpdate (chunk-JBUGR5HP.js?v=2759a9d4:8683:253)
at AnchorShow (show.tsx:98:27) <-- my entrypoint

Also intermitantly getting the same error for a on a list item within a

Steps To Reproduce

Simple model detail view with a const { mutateAsync } = useUpdate();
Same with the delete, straight from the docs

Expected behavior

Not to crash

Packages

  • @refinedev/core

Additional Context

No response

@daxaxelrod daxaxelrod added the bug Something isn't working label Oct 26, 2024
@BatuhanW
Copy link
Member

Hey @daxaxelrod, can you list your other dependencies too? I think it happens if you are using react-query v5. If you are using v5, we don't support react-query v5 yet. You can find context here: #5370 (comment)

Closing the issue for now, feel free to re-open it if problem is different.

@BatuhanW BatuhanW closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2024
@daxaxelrod
Copy link
Author

Thanks for the response! While i hadnt explicitly installed react query for our refine application, the app sits within a monorepo where 5.x was installed. Resolved!

@daxaxelrod
Copy link
Author

daxaxelrod commented Oct 28, 2024

Actually turning out to be a bit more involved. I installed trpc to the repo which is v11. Trpc is really nit picky about versions and needs to be on the same version across the stack. Our backend is also v11 (and cant be changed) which locks the frontend into needing to be v11, which has a hard requirement of react-query 5.xx

https://www.npmjs.com/package/@trpc/react-query/v/11.0.0-rc.593?activeTab=code

So despite the main tanstack react query being the right <5 version, the trpc one overrides it.

"@tanstack/react-query": "^4.10.1",
"@trpc/react-query": "next",

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

2 participants