feat(store): architect centralized state management layer with Zustan… - #181
feat(store): architect centralized state management layer with Zustan…#181ChinmaySonar007 wants to merge 1 commit into
Conversation
…d slices and atomic selectors
|
Skipping CodeAnt AI review — this PR is a back-merge between long-lived branches ( If you want to analyze this anyway (e.g. you resolved conflicts with new logic), comment |
📝 WalkthroughWalkthroughThe frontend adds a Zustand data store, centralizes store exports and selector hooks, and updates application components to subscribe to specific state values and actions. ChangesZustand state management
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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: 2
🤖 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/src/components/layouts/MainLayout.tsx`:
- Around line 4-7: Update the imports in MainLayout.tsx: add useLogbookStore to
the existing `@/store` import and add the MaterialIcon import from
`@/components/MaterialIcon` so all referenced symbols resolve.
In `@frontend/src/store/index.ts`:
- Around line 4-8: Import useAuthStore, useDataStore, useLayerStore,
useLogbookStore, and useUIStore into frontend/src/store/index.ts before the
selector hooks, then re-export those imported bindings while preserving the
existing type and logEvent exports. Ensure all selector hooks reference locally
declared store identifiers.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: efb4aaca-b75a-4ab0-9e81-986ca41fdd94
📒 Files selected for processing (6)
frontend/src/App.tsxfrontend/src/components/EarthTwin.tsxfrontend/src/components/layouts/MainLayout.tsxfrontend/src/pages/Satellites.tsxfrontend/src/store/dataStore.tsfrontend/src/store/index.ts
Summary
Architected a centralized state management layer in src/store/ using Zustand slices (authStore, dataStore, layerStore, logbookStore, uiStore) and fine-grained atomic selector hooks (useIsAuthenticated, useSidebarCollapsed, useSelectedSatelliteId, useDataFilters, etc.).
Refactored src/App.tsx, src/components/layouts/MainLayout.tsx, src/pages/Satellites.tsx, and src/components/EarthTwin.tsx to consume store state via atomic selectors rather than whole-store destructuring. This decouples business/telemetry state from UI layout components and eliminates unnecessary re-renders across the React tree.
Related Issue
Fixes #177
Type of Change
Screenshots / Screen Recordings
Testing Performed
Breaking Changes
None. All existing Zustand store states, actions, and persistent storage configurations remain fully backward-compatible.
Checklist
ECSoC26 Submission
ECSoC26-L1– BeginnerECSoC26-L2– IntermediateECSoC26-L3– AdvancedSummary by CodeRabbit
New Features
Improvements