fix: possible infinite loop when navigating #3236
Merged
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.
Greptile Summary
This PR fixes a potential infinite loop bug in the tenant page navigation by removing a redundant state update from the
handleTenantPageChangecallback.setInitialTenantPage(value)call fromhandleTenantPageChangecallback inuseTenantPagehookuseEffect(lines 89-103) already handles persisting the initial page preference to Redux when the query param changesConfidence Score: 5/5
Important Files Changed
setInitialTenantPagecall fromhandleTenantPageChangecallback to fix potential infinite loop; theuseEffectalready handles persisting the initial page preference.Sequence Diagram
sequenceDiagram participant User participant handleTenantPageChange participant setQueryParams participant useEffect participant setInitialTenantPage participant Redux User->>handleTenantPageChange: Click navigation item Note over handleTenantPageChange: Before fix: called both setQueryParams AND setInitialTenantPage handleTenantPageChange->>setQueryParams: Update URL query params setQueryParams-->>useEffect: tenantPageFromQuery changes useEffect->>useEffect: Parse query page alt Query page valid and different from initial useEffect->>setInitialTenantPage: Save as initial page setInitialTenantPage->>Redux: Update settings state else Query page invalid useEffect->>setQueryParams: Reset to initial page end Note over handleTenantPageChange: After fix: only calls setQueryParams<br/>useEffect handles initial page persistenceCI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 62.54 MB | Main: 62.54 MB
Diff: 0.10 KB (-0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information