-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(useAsync$): implement RFC 324 #8301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+2,826
−2,102
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: 054348d The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Contributor
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
gioboa
approved these changes
Feb 5, 2026
2409f7c to
af129d0
Compare
Varixo
reviewed
Feb 5, 2026
packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
Outdated
Show resolved
Hide resolved
de376be to
37f0b55
Compare
c4dc275 to
1a853e0
Compare
03e56a7 to
a7e65e0
Compare
this allows dynamically changing polling, even from within the compute function
- simplify logic, one less class attribute - clear invalidate on compute start so that new invalidations are noted - change `.promise()` to return `Promise<void>` - reading `.loading` triggers computation - reading `.loading` during SSR throws the completion promise - try harder to get the container on signal init - serdes: don't send loading state, it's always false - serdes: correctly set invalid flag - serdes: default to always serialize asyncSignals (expensive compute) and never computed (cheap compute)
this wasn't triggering effects after resume and recalc when not serializing the value
- allow async cleanup in asyncsignals, await before running next - track each invocation separately and provide track/cleanup lazily - don't allow writing to result when not most recent invocation - remove RUN_EFFECTS from computed and serialized signal (but keep it for wrapped for now) - allow subscribing to a signal even when the container is missing (mostly for tests) - fix computed invalidation on first calculation - remove noSerialize from `$destroy$`
this allows running the async fn whenever it invalidates also, refactor the logic to be all in the AsyncSignalImpl class, not the Job
also deprecate `useResource$` and friends
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This implements the
useAsync$RFCuseResource$and removes it from docsintervalto useAsync$ options to automatically rerun every x mssignal.interval, even from within the compute function (but you will have to have a self reference), and it will do the right thinguseAsync$is now 'always' instead of 'never', because it is likely to be expensive to getconcurrency,abortandtimeoutsupportBREAKING
.promise()method onuseAsync$now returns aPromise<void>instead ofPromise<T>, to avoid having to put.catch()on every call and to promote using the reactiveresult.valueandresult.errorproperties for handling async results and errors.