Skip to content

Fix/reset enrichment state on visible change#381

Merged
Mosas2000 merged 21 commits into
mainfrom
fix/reset-enrichment-state-on-visible-change
May 13, 2026
Merged

Fix/reset enrichment state on visible change#381
Mosas2000 merged 21 commits into
mainfrom
fix/reset-enrichment-state-on-visible-change

Conversation

@Mosas2000

Copy link
Copy Markdown
Owner

What Was Fixed
Infinite Loop Issue: Removed tipMessages from effect dependencies and used a ref-based cache tracking system to prevent infinite re-renders
Stale State Detection: Added visible set change detection to identify when the tip list changes materially
Request Cancellation: Implemented request ID tracking to properly cancel stale requests during rapid pagination
State Reconciliation: Added logic to clear or filter cached state based on overlap with previous visible set
Loading State Management: Improved loading state handling to prevent stale indicators
Key Technical Changes
Used tipMessagesRef to track cache state without triggering effect re-runs
Implemented request ID system to prevent race conditions
Added clearCounter state to force recalculation after manual clear
Simplified cleanup logic to avoid premature request cancellation
Added comprehensive inline documentation
Testing
All 14 tests pass successfully
Added tests for rapid pagination, filtering, and stale state prevention
Verified no regressions in existing functionality

Closes #340

@Mosas2000 Mosas2000 merged commit 75c30f5 into main May 13, 2026
3 of 8 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.

useSelectiveMessageEnrichment should reset stale enrichment state when the visible set changes

1 participant