fix: resolve infinite re-render loops, context provider errors, and u…#586
Merged
Mosas2000 merged 2 commits intoJun 13, 2026
Conversation
|
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:
For more information about GitHub Code Scanning, check out the documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.
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).
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.
frontend/src/main.tsx: Wrapped the component in both and to ensure context values are correctly resolved on first load.