Zustand store spike#1145
Zustand store spike#1145BobDickinson wants to merge 4 commits intomodelcontextprotocol:v1.5/mainfrom
Conversation
…ools(manager only) Made-with: Cursor
|
@claude review |
|
Claude finished @BobDickinson's task in 2m 30s —— View job PR Review: Zustand Store Spike
OverviewThe design direction is sound. Replacing the custom Critical Issue: Unstable
|
…sState.getStore() and resolving the store once in useManagedTools for subscribe and getSnapshot.
|
Fixed both review suggestions. |
|
@BobDickinson How do we go about testing this? I'm not deeply familiar with the state managers and their hooks yet, so It would be good to have a little more explanation of the previous architecture and how this change works. Also, please tag issues/prs for |
Draft PR for discussion
I ported one state manager (ManagedToolsState) and its hook (useManagedTools) to use a Zustand store. If this design works, or if we can arrive at one that does, I'll convert the rest of the state managers and hooks.
I tried a couple of approaches. I think this one lines up the best with the idea that the underlying state data comes from InspectorClient and the state managers were designed to manage the state through InspectorClient, while at the same time exposing a Zustand store for the hook to use. And because the state manager is managing the underlying state, I chose to have it export a read-only Zustand state (the state should never be set from anywhere except the state manager). This should give us the same state manager benefits and the expected synchronization benefits of Zustand (without the extra event mechanism between the state manager and the hook). It also makes the hooks much simpler.
Feedback appreciated.