Skip to content

fix(web): prevent stale responses from overwriting results - #682

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
BharadwajKanneveti:fix/content-stale-responses
Aug 8, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
BharadwajKanneveti:fix/content-stale-responses

Conversation

@BharadwajKanneveti

Copy link
Copy Markdown
Contributor

Summary

Prevent stale content opportunity requests from overwriting the table when filters change rapidly.

The content data loader now uses an effect-scoped cancellation flag to ensure that only the latest request can update the opportunities and pagination state. Stale requests are also prevented from changing the loading state after they become outdated.

Related issue

Closes #663

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

Checklist

@gkhngyk gkhngyk mentioned this pull request Aug 8, 2026
7 of 12 tasks

@gkhngyk gkhngyk 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.

Clean implementation of #663 — isCancelled checked after the await, setLoading guarded in finally, cleanup in the effect. Approving.

One non-blocking suggestion worth a follow-up commit (here or later): the catch still toasts unconditionally, so a request aborted by navigating away can pop "Failed to load content opportunities" on the next page — the same symptom we just filed for Citations in #684. An early if (isCancelled?.()) return 0; at the top of the catch closes it.

Heads-up: #681 modifies the same loadData/effect — coordinate the merge order between your two branches.

@gkhngyk
gkhngyk merged commit 20067d3 into ansvisor:main Aug 8, 2026
4 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.

Content: stale responses can overwrite the list on rapid filter changes

2 participants