fix: createAsync - catch errors of prev to avoid bubbling error up
currently when the inner function of createAsync's inner function throws after an arg has updated, the error will not be caught by the closest ErrorBoundary that wraps the accessor. It will bubble up instead. Which is kind of inconsistent, because if there is an initial error it will be caught by the closest ErrorBoundary
wrapping the the prev in catchError and returning undefined instead resolves this.
[resource] = createResource(
() =>
subFetch(
fn,
catchError(
() => untrack(prev),
() => undefined
)
),
v => v,
Also added tests for a few different simple scenarios of create async.
🦋 Changeset detected
Latest commit: 8885abf974a65b0914362d739b56770d555c45ae
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @solidjs/router | Patch |
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
Thank you. There are definitely some gaps because the way we hacked around createResource.