Skip to content

feat(store): architect centralized state management layer with Zustan… - #181

Open
ChinmaySonar007 wants to merge 1 commit into
7-Blocks:mainfrom
ChinmaySonar007:main
Open

feat(store): architect centralized state management layer with Zustan…#181
ChinmaySonar007 wants to merge 1 commit into
7-Blocks:mainfrom
ChinmaySonar007:main

Conversation

@ChinmaySonar007

@ChinmaySonar007 ChinmaySonar007 commented Aug 8, 2026

Copy link
Copy Markdown

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

  • 🐛 Bug fix
  • ✨ New feature
  • 📚 Documentation update
  • 🚀 Performance improvement
  • 🎨 UI/UX enhancement
  • 🔧 Refactoring
  • 🧹 Chore / Maintenance
  • 🔒 Security improvement

Screenshots / Screen Recordings

Testing Performed

  • Tested locally
  • Tested relevant functionality
  • Checked for linting errors
  • Checked for TypeScript/build errors
  • Tested responsive behavior (if applicable)

Breaking Changes

None. All existing Zustand store states, actions, and persistent storage configurations remain fully backward-compatible.

Checklist

  • I have read and followed the contributing guidelines.
  • My code follows the project's coding standards and guidelines.
  • I have completed testing of my changes.
  • I have updated documentation where applicable.
  • I have checked that my changes do not introduce unintended regressions.

ECSoC26 Submission

ECSoC26 contributors only — select your difficulty level by checking exactly one box below.
Leaving all boxes unchecked, or checking more than one, will cause the automation to fail.

  • ECSoC26-L1 – Beginner
  • ECSoC26-L2 – Intermediate
  • ECSoC26-L3 – Advanced

Summary by CodeRabbit

  • New Features

    • Added centralized controls for risk, time range, keyword, altitude, collision, and automatic refresh settings.
    • Added an option to reset data filters and collision selections to their defaults.
  • Improvements

    • Improved consistency and responsiveness when managing sidebar, drawer, search, layer, and satellite-selection state across the application.

@codeant-ai

codeant-ai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Skipping CodeAnt AI review — this PR is a back-merge between long-lived branches (mainmain). The diff here has already been reviewed when the underlying commits landed on the source branch, so re-running analysis would produce duplicate findings on already-reviewed code.

If you want to analyze this anyway (e.g. you resolved conflicts with new logic), comment @codeant-ai : review and CodeAnt will start a review.

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend development size/M Medium-sized contribution. size:M This PR changes 30-99 lines, ignoring generated files type:bug Fixes an existing bug or unexpected behavior. type:documentation Improves project documentation. type:feature Introduces a new feature or enhancement. type:frontend Changes frontend or client-side code. ECSoC26 Official label for ECSoC26 event contributions. ECSoC26-L2 Level 2 contribution for the ECSoC26 event. labels Aug 8, 2026
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The frontend adds a Zustand data store, centralizes store exports and selector hooks, and updates application components to subscribe to specific state values and actions.

Changes

Zustand state management

Layer / File(s) Summary
Data store contract and implementation
frontend/src/store/dataStore.ts
Adds filter types, data state, defaults, setters, collision selection, refresh settings, and reset behavior.
Store barrel and selector exports
frontend/src/store/index.ts
Re-exports stores and adds selector hooks for authentication, UI, layers, logbook, and data state.
Component selector migration
frontend/src/App.tsx, frontend/src/components/EarthTwin.tsx, frontend/src/components/layouts/MainLayout.tsx, frontend/src/pages/Satellites.tsx
Updates components to use centralized imports and individual store selectors instead of full-store subscriptions or direct store modules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: thelinuxguy-ssh, sumittiwari1302, varshu55

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement the linked issue by adding centralized Zustand stores, atomic selectors, and refactoring state consumers to reduce re-renders.
Out of Scope Changes check ✅ Passed All changes support the linked issue objectives and remain within centralized state management and related consumer refactoring.
Description check ✅ Passed The description covers the required sections, explains the centralized Zustand architecture, documents testing, and selects exactly one ECSoC26 level.
Title check ✅ Passed The title clearly identifies the main change: a centralized state management layer using Zustand.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the AI Artificial Intelligence and Machine Learning label Aug 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9ac97e9 and 74772e7.

📒 Files selected for processing (6)
  • frontend/src/App.tsx
  • frontend/src/components/EarthTwin.tsx
  • frontend/src/components/layouts/MainLayout.tsx
  • frontend/src/pages/Satellites.tsx
  • frontend/src/store/dataStore.ts
  • frontend/src/store/index.ts

Comment thread frontend/src/components/layouts/MainLayout.tsx
Comment thread frontend/src/store/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Artificial Intelligence and Machine Learning bug Something isn't working documentation Improvements or additions to documentation ECSoC26-L2 Level 2 contribution for the ECSoC26 event. ECSoC26 Official label for ECSoC26 event contributions. enhancement New feature or request frontend Frontend development size/M Medium-sized contribution. size:M This PR changes 30-99 lines, ignoring generated files type:bug Fixes an existing bug or unexpected behavior. type:documentation Improves project documentation. type:feature Introduces a new feature or enhancement. type:frontend Changes frontend or client-side code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Architecture: State Management Migration to Redux Toolkit / Zustand

1 participant