refactor: remove loadingStore and move the state into chat context#1593
Conversation
WalkthroughMigrates loading state from a standalone Zustand store ( ChangesLoading state consolidation and consumer updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labelsrefactor 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/app/chat/page.tsx`:
- Around line 51-53: The PR moved the UI "loading" state into
ChatContext/useChat, which violates the repo policy to keep frontend state in
Zustand stores; revert ownership by removing loading and setLoading from the
ChatContext consumer usage and instead read/write that boolean from the
appropriate Zustand store (e.g., stores/chatStore) in this component and any
other components that relied on useChat for loading. Update useChat/ChatContext
to stop exposing loading/setLoading (or keep them but delegate to the store),
add or reuse a selector like useChatStore(state => state.loading) and an updater
like useChatStore(state => state.setLoading) in page.tsx, and adjust any
handlers that toggle loading to call the store setter; ensure imports reference
the store instead of ChatContext/useChat and keep other ChatContext APIs
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 05f84369-cfa3-4d54-b967-d6a46305d4a2
📒 Files selected for processing (1)
frontend/app/chat/page.tsx
loadingStorewas only used by the chat so moved that state into theChatContextSummary by CodeRabbit