Skip to content

Conversation

@wmertens
Copy link
Member

@wmertens wmertens commented Feb 4, 2026

This implements the useAsync$ RFC

  • deprecates useResource$ and removes it from docs
  • adds interval to useAsync$ options to automatically rerun every x ms
  • you can change signal.interval, even from within the compute function (but you will have to have a self reference), and it will do the right thing
  • when you set pollMs during SSR, it will automatically resume on the client, as part of qidle
  • refactors the async signal class to simplify
  • the default serialization strategy for useAsync$ is now 'always' instead of 'never', because it is likely to be expensive to get
  • concurrency, abort and timeout support

BREAKING

  • the .promise() method on useAsync$ now returns a Promise<void> instead of Promise<T>, to avoid having to put .catch() on every call and to promote using the reactive result.value and result.error properties for handling async results and errors.

@wmertens wmertens requested review from a team as code owners February 4, 2026 22:18
@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest 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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8301
npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8301
npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8301
npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8301

commit: 30630b5

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 30630b5

@wmertens wmertens force-pushed the use-async branch 2 times, most recently from 2409f7c to af129d0 Compare February 5, 2026 15:35
@wmertens wmertens force-pushed the use-async branch 2 times, most recently from de376be to 37f0b55 Compare February 7, 2026 00:24
@wmertens wmertens changed the title feat(useAsync$): pollMs option feat(useAsync$): pollMs / initial / refactor Feb 7, 2026
@wmertens wmertens force-pushed the use-async branch 4 times, most recently from c4dc275 to 1a853e0 Compare February 8, 2026 20:42
@wmertens wmertens self-assigned this Feb 9, 2026
@wmertens wmertens moved this from Backlog to Waiting For Review in Qwik Development Feb 9, 2026
@wmertens wmertens changed the title feat(useAsync$): pollMs / initial / refactor feat(useAsync$): implement RFC Feb 9, 2026
@wmertens wmertens changed the title feat(useAsync$): implement RFC feat(useAsync$): implement RFC 324 Feb 9, 2026
@wmertens wmertens force-pushed the use-async branch 2 times, most recently from 03e56a7 to a7e65e0 Compare February 9, 2026 21:54
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
@wmertens wmertens enabled auto-merge February 10, 2026 15:30
@wmertens wmertens merged commit d02eb6f into build/v2 Feb 10, 2026
18 checks passed
@wmertens wmertens deleted the use-async branch February 10, 2026 15:44
@github-project-automation github-project-automation bot moved this from Waiting For Review to Done in Qwik Development Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[🐞] v2: useAsync$/useAsyncComputed$ is not working correctly when using .loading property

3 participants