@tanstack/react-store@0.9.1 causes atom?.get is not a function runtime error (works in 0.8.1) #280
Describe the bug#
After upgrading @tanstack/react-store from 0.8.1 to 0.9.1, the application crashes in the browser at runtime with:
Uncaught TypeError: atom?.get is not a function at @tanstack_react-store.js:638:70 at mountSyncExternalStore (react-dom_client.js:6001:26) at Object.useSyncExternalStore (react-dom_client.js:18758:18) at useStore (@tanstack_react-store.js:639:86) at useRouterState (useRouterState.js:20:10)
Steps to Reproduce the Bug or Issue#
Steps to Reproduce
Option 1 — Using the provided reproduction repository
Clone the repository:
git clone https://github.com/jeanzuck/reproduce-tanstack-react-store-0.9.1Install dependencies:
pnpm installStart the development server:
pnpm devOpen
http://localhost:3000and observe the console error.
Option 2 — Reproducing in a fresh project
Create a new TanStack Start project:
pnpm create @tanstack/start@latestInstall
@tanstack/react-store:pnpm add @tanstack/react-storeUse the example code from the TanStack Store React Quick Start documentation.
Run the application:
pnpm devOpen
http://localhost:3000and observe the console error.
Expected behavior#
The app should run normally without runtime errors, consistent with behavior in @tanstack/react-store@0.8.1.
Screenshots or Videos#
No response
Platform#
- OS: Windows 11
- Browser: Chrome, Edge
Additional context#
No response
Me too, on a fresh install
Getting the same error when using the store with TanStack Start. Using version
0.9.1I don't have
storeas a dependency but I am using@tanstack/react-routerandv1.161.3bumped its dependency onstoreto0.9.1and I've been getting odd errors since like:TypeError: Cannot read properties of undefined (reading 'atom')When I downgrade to
v1.161.1(the previous published release) of@tanstack/react-router(which usesv0.8.0ofstore) the issues are resolved.I will share my experience. I also had same error when upgraded to 0.9.1, but in my case it happend when i had mixed useStore from '@tanstack/react-store' and useStore from '@tanstack/react-form'. for example:
const errors = useStore(field.store, (state) => state.meta.errors)anduseStore from '@tanstack/react-store'then it breaks withatom?.get is not a function.Or maybe it was already patched, i run
@tanstack-start@1.166.1, @tanstack-router@1.163.3, @tanstack/react-store@0.9.1, @tanstack/react-form:1.28.3Hey all, quick update here.
First: Apologies for how rough this merge has been for y'all. This is squarely my fault. I didn't do sufficient due diligence in communicating with our internal libraries when this was going to be released. While we're confident in the underlying code (hence the merge) I should be been more cognizant in making sure we were patching across the board before going live.
We're working with the Router, Start, and even Table teams to make sure that these issues are addressed soon; as it seems that this is a
peerDepinstallation issue at first glance. I'll update the ticket here as we have more to add.Thanks for your patience and apologies once again for the impact y'all are facing.
I believe this issue is now resolved now that Form, Start, Router, and Store are all aligned on the newest
0.9.1release. If you're still experiencing problems, please upgrade your packages.Apologies once more for the headaches!
crutchcorn(GitHub profile, opens in a new tab) closed this
Resolved for me, thank you @crutchcorn
Sign in to join this conversation.
Can confirm. Having the same issue.