Skip to content
Source
Sign inSign up
TanStack/store

@tanstack/react-store@0.9.1 causes atom?.get is not a function runtime error (works in 0.8.1) #280

Closedjeanzuck(GitHub profile, opens in a new tab) opened this issue 8 comments

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

  1. Clone the repository:

    git clone https://github.com/jeanzuck/reproduce-tanstack-react-store-0.9.1
  2. Install dependencies:

    pnpm install
  3. Start the development server:

    pnpm dev
  4. Open http://localhost:3000 and observe the console error.

Option 2 — Reproducing in a fresh project

  1. Create a new TanStack Start project:

    pnpm create @tanstack/start@latest
  2. Install @tanstack/react-store:

    pnpm add @tanstack/react-store
  3. Use the example code from the TanStack Store React Quick Start documentation.

  4. Run the application:

    pnpm dev
  5. Open http://localhost:3000 and 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

  1. Can confirm. Having the same issue.

  2. Getting the same error when using the store with TanStack Start. Using version 0.9.1

  3. I don't have store as a dependency but I am using @tanstack/react-router and v1.161.3 bumped its dependency on store to 0.9.1 and 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 uses v0.8.0 of store) the issues are resolved.

  4. 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) and useStore from '@tanstack/react-store' then it breaks with atom?.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.3

  5. Hey 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 peerDep installation 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.

  6. I believe this issue is now resolved now that Form, Start, Router, and Store are all aligned on the newest 0.9.1 release. If you're still experiencing problems, please upgrade your packages.

    Apologies once more for the headaches!

  7. Resolved for me, thank you @crutchcorn

Sign in to join this conversation.