Repository navigation
feat: room-store: expose bound useRoomStore API, add useRoomStoreApi - #360
Conversation
…pi hook Signed-off-by: Ilya Boyandin <[email protected]>
📝 WalkthroughWalkthroughVersion 0.27.0-rc.5 introduces imperative Zustand store access through augmented useRoomStore hooks with built-in API methods (getState, setState, subscribe, getInitialState) and new useRoomStoreApi() for context-based non-reactive access. Public exports are reorganized across packages. Changes
Sequence DiagramsequenceDiagram
participant Component
participant RoomStateProvider as RoomStateProvider<br/>(RoomStateContext)
participant Store as Zustand Store<br/>(StoreApi)
rect rgba(76, 175, 80, 0.5)
Note over Component,Store: Reactive Access Pattern
Component->>Component: useRoomStore(selector)
Component->>Store: subscribe & get selected state
Store->>Component: return selected value T
end
rect rgba(33, 150, 243, 0.5)
Note over Component,Store: Imperative Access Pattern
Component->>Component: useRoomStoreApi()
Component->>RoomStateProvider: retrieve StoreApi from context
RoomStateProvider->>Store: return raw StoreApi
Store->>Component: {getState, setState, subscribe, getInitialState}
Component->>Store: call getState/setState/subscribe as needed
Store->>Component: perform imperative operation
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fixes #335
Makes imperative room-store access reliable by aligning useRoomStore with Zustand-style bound store methods (getState, setState, subscribe, getInitialState) while preserving selector-based usage. Adds useRoomStoreApi() for context-based imperative access, re-exports it from room-store and room-shell, and updates docs (whats-new + room-store README) including non-reactive usage guidance.
Summary by CodeRabbit
New Features
Documentation