Skip to content

fix: ignore stale contract pagination responses - #2

Merged
Joon2000 merged 1 commit into
mainfrom
fix/stale-contract-pagination
Oct 22, 2026
Merged

Joon2000 merged 1 commit into
mainfrom
fix/stale-contract-pagination

Conversation

@graykode

Copy link
Copy Markdown
Collaborator

An Older request can finish after the user changes a contract filter and overwrite the new results with the previous list. A late failure can also display an error after a refresh or after leaving the page.

Carry the initial read's cancellation guard into its pagination requests. Once that read is cancelled, ignore its pagination responses and errors, and prevent further requests from its cursor. This also handles returning to the same filter after an intervening change.

Add component tests with controlled promise resolution to cover filter changes, refreshes, offset changes, unmounting, and normal pagination. The regression cases fail on main and pass with the fix. jsdom is added as a development dependency to run the DOM tests with the existing Node/Vite test setup.

Validation: pnpm typecheck, pnpm lint, pnpm openapi:check, and pnpm test all pass.

cc @Joon2000

@Joon2000

Copy link
Copy Markdown
Collaborator

The fix looks right — the race is still on main, and threading cancelled into the page as isCurrent() is the clean way to close it. jsdom as a dev dependency is fine.

It's conflicting on Contracts.tsx now, only because #1 and #23 moved lines nearby. Could you rebase? Happy to approve as soon as it's green.

@graykode

Copy link
Copy Markdown
Collaborator Author

Rebased onto main. The only conflict was the Page type in Contracts.tsx: main now exports it, so the export is kept with the isCurrent field added. pnpm typecheck, pnpm lint, pnpm openapi:check, and pnpm test (79 tests) pass on the rebased branch.

@graykode
graykode force-pushed the fix/stale-contract-pagination branch from 81e5f2e to a9ceb51 Compare October 22, 2026 00:21

@Joon2000 Joon2000 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Joon2000
Joon2000 merged commit ec0d857 into main Oct 22, 2026
5 checks passed
@Joon2000
Joon2000 deleted the fix/stale-contract-pagination branch October 22, 2026 02:57
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.

2 participants