Describe the bug#
I have a use case where I store ReactNode items in the store. Different parts of the app register some informational elements and then they are all displayed in a single place in the root layout.
I encounter a problem during development (not sure if it matters but I am using Vite) where updates to any of the registered child components are not detected, which ends up not re-rendering them in the root layout. The same feature works when implementing it with React Context.
I am attaching a reproduction repo that contains AppWithStore.tsx and AppWithContext.tsx with the same feature implemented using both React Context and TanStack Store.
Steps to Reproduce the Bug or Issue#
Expected behavior#
I assume the problem is somewhat related to change detection mechanisms withing the store. So I would expect that this change detection works correctly for React Nodes.
Platform#
- "@tanstack/store": "0.7.7"
- "react": "19.2.0" and "react": "18.3.1"
I spent a bit more time debugging this and it turned out to be a problem on my side. I didn't setup dependency array in
useEffectcorrectly. Closing as this is not a real Store problem.