Skip to content

fix: Handle aborted signals by making pending promises always return the latest value - #20

Merged
iwoplaza merged 2 commits into
mainfrom
fix/handle-aborted-signals
May 31, 2026
Merged

fix: Handle aborted signals by making pending promises always return the latest value#20
iwoplaza merged 2 commits into
mainfrom
fix/handle-aborted-signals

Conversation

@iwoplaza

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread packages/jotai-eager/src/eagerAtom.ts Outdated
// computation.
if (signal.aborted) {
return undefined as T;
return getLatest();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

that's neat! 😎

@iwoplaza
iwoplaza force-pushed the fix/handle-aborted-signals branch from 297df9e to 07f79ec Compare May 31, 2026 09:48
@iwoplaza

Copy link
Copy Markdown
Collaborator Author

@Aliath I added one more commit that handles old computations that never resolve, with additional tests that cover those cases

Comment thread packages/jotai-eager/src/eagerAtom.ts Outdated
@iwoplaza
iwoplaza force-pushed the fix/handle-aborted-signals branch from ea1e5fd to 4568c2a Compare May 31, 2026 19:00
@iwoplaza
iwoplaza merged commit c1cc4de into main May 31, 2026
1 check passed
@iwoplaza
iwoplaza deleted the fix/handle-aborted-signals branch May 31, 2026 19:02
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