Skip to content

fix: resolve infinite re-render loops, context provider errors, and u…#586

Merged
Mosas2000 merged 2 commits into
StellaBridge:mainfrom
devmocrea:feature/contract-source-priority-rollup-replay-ranking
Jun 13, 2026
Merged

fix: resolve infinite re-render loops, context provider errors, and u…#586
Mosas2000 merged 2 commits into
StellaBridge:mainfrom
devmocrea:feature/contract-source-priority-rollup-replay-ranking

Conversation

@devmocrea

Copy link
Copy Markdown

This PR resolves critical runtime crashes, infinite navigation/rendering loops, and test failures in the frontend:

Infinite Render Loop ("Maximum update depth exceeded"): Refactored how components consume Zustand stores to prevent rendering loops triggered by object-returning selectors.
Landing Page Navigation Loop: Resolved an issue where query parameter discrepancies caused infinite redirects when query params were present on the root route.
Missing Context Providers: Added missing theme and WebSocket providers at the React root to prevent context initialization crashes.
Vitest Failures: Fixed accessibility selectors in loader skeletons and updated query assertions to align with current UI designs.
Key Changes

  1. Zustand Selector Optimizations & Re-render Loop Fixes
    frontend/src/stores/index.ts (useTheme): Refactored the hook to select primitive fields (resolvedMode, toggleMode, etc.) individually instead of returning a new object on every selector run.
    frontend/src/pages/Dashboard.tsx & frontend/src/components/dashboard/AssetDiscoverySection.tsx: Replaced the compound selectInsightsTray selector. The components now select the required properties/actions (insightsTrayOpen, insightsTraySymbol, closeInsightsTray, and openInsightsTray) individually.
    frontend/src/hooks/useWebSocketEnhanced.ts:
    Wrapped the selectActiveChannels array selector in useShallow to prevent unnecessary component updates.
    Refactored action selection to retrieve methods individually via useShallow, preventing components utilizing this hook from re-rendering on every incoming WebSocket message.
  2. Router & TimeRange Synchronization Loop Fix
    frontend/src/hooks/useTimeRange.tsx: Introduced a semantic query parameter comparison helper (searchParamsEqual) to check whether the incoming and next query strings match. This prevents infinite replacement loops caused by different parameter encodings (e.g. how lists are encoded in the URL).
  3. Accessible skeletons & Vitest Fixes
    frontend/src/components/timeline/RecentActivityTimeline.tsx: Converted skeleton loader wrapper containers from div to article and added aria-busy="true" so they expose the correct accessibility roles expected by the testing suite.
    frontend/src/components/timeline/RecentActivityTimeline.test.tsx: Updated placeholder search assertions from "Search events..." to "Search activity", and removed the obsolete collapsible filters toggle test.
  4. Root Provider Wrap
    frontend/src/main.tsx: Wrapped the component in both and to ensure context values are correctly resolved on first load.

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@Mosas2000 Mosas2000 merged commit 95c7c97 into StellaBridge:main Jun 13, 2026
13 of 20 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.

3 participants