Skip to content

Improve loading states and fix authentication data fetching#48

Merged
jorilindell merged 5 commits into
mainfrom
fix-redux-store-issues
Jan 5, 2026
Merged

Improve loading states and fix authentication data fetching#48
jorilindell merged 5 commits into
mainfrom
fix-redux-store-issues

Conversation

@jorilindell

Copy link
Copy Markdown
Contributor

Summary

Implements proper loading state management and fixes race conditions in data fetching when user authentication state changes.

Key Changes

  • Dependency: Replace redux-localstorage with redux-persist
  • Add Redux loading state tracking to distinguish "loading" vs "no results"
  • Fix geolocation reset bug after login/logout
  • Prevent unauthenticated API calls from overriding authenticated data
  • Update Dashboard to show proper loading indicators

Fixes

  • Loading indicators now show when actually fetching data
  • Location services work properly after login
  • No more data corruption from competing API requests

@jorilindell jorilindell force-pushed the fix-redux-store-issues branch from 7922447 to 8e76ef7 Compare January 5, 2026 15:39
- Update store configuration to use redux-persist instead of redux-localstorage
- Add PersistGate wrapper component for state rehydration
- Configure whitelist-based persistence for better control over persisted state
- Add loading state tracking to Redux store with initial states for unit/service
- Implement GET_RESOURCE_START action to set loading states to true
- Update dataReducer to handle loading state transitions and normalize state structure
- Modify Dashboard component to use loading state instead of checking for undefined data
- Add setResourceFetchStart action dispatch in Main component before fetch operations
- Add reset parameter to getInitialLocation() to reset currentStage
- Fix bug where geolocation wouldn't work after login due to persistent currentStage
- Ensure getNearestUnits() is called properly on subsequent app sessions
- Pass reset=true explicitly when calling getInitialLocation in Main component
@jorilindell jorilindell force-pushed the fix-redux-store-issues branch 3 times, most recently from 871919a to 7ebe828 Compare January 5, 2026 15:55

@mhieta mhieta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks excellent! 💯

unnecessary import
@jorilindell jorilindell force-pushed the fix-redux-store-issues branch from 7ebe828 to 8269783 Compare January 5, 2026 16:16
@sonarqubecloud

sonarqubecloud Bot commented Jan 5, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 65%)

See analysis details on SonarQube Cloud

@jorilindell jorilindell merged commit 2771282 into main Jan 5, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants