feat(qwik-router): error channel — return error() → .error, deprecate fail()/value.failed#8738
Open
maiieul wants to merge 12 commits into
Open
feat(qwik-router): error channel — return error() → .error, deprecate fail()/value.failed#8738maiieul wants to merge 12 commits into
maiieul wants to merge 12 commits into
Conversation
🦋 Changeset detectedLatest commit: a228b2a The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
commit: |
Contributor
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
…ault Reading .value in an error state returns the stale/initial value instead of re-throwing; the error stays available via .error/.untrackedError. The throw path is preserved behind an internal THROW_ON_ERROR flag (unexposed) for a future throwOnError option.
return error(status, data) now surfaces a typed ServerError on loader.error / action.error (typed ValidatorErrorType for zod$/valibot$/validator$). return fail() and the .value.failed branch are deprecated but keep working. throw error() still aborts to the error page. Validator failures populate both channels for back-compat.
…omise) Actions now mirror the loader AsyncSignal shape: add reactive `loading` and a `promise()` that resolves when the in-flight submission settles. `isRunning` is kept as a deprecated alias of `loading`. Non-breaking minor.
…r channel - route-loader 'Signaling failure': describe the real model (return error() → .error; return fail() → .value.failed deprecated; throw error() → abort), was describing the old both-to-.error design - action success render gated on !action.error (action.value holds the deprecated fail-union on validator failures, so a bare check rendered success on failure) - validator page: restore a typed action.error.fieldErrors read example - polish: error() phrasing + /error/ highlight, Futhermore typo, fieldErrors note
The action store can be captured in $ scopes, so promise must be a QRL (like submit) rather than a plain function. Runtime already returned a QRL via $(); this aligns the type.
453c9f7 to
ccb966f
Compare
valid-lexical-scope rejected class instances captured in $ scopes, but Qwik serializes any `instanceof Error`. Recognize Error subclasses (e.g. ServerError from action.error) as serializable, matching the serializer.
ccb966f to
c13e4f4
Compare
- AsyncSignal.value no longer leaks the NEEDS_COMPUTATION sentinel in an
error state — it returns undefined, so {value && ...} is falsy.
- When an errored signal's .error is never read, log a dev-only warning
(opt into prod with globalThis.qWarnUnhandledErrors = true).
- return fail() and validators now also populate .error (the one failure
channel); .value.failed stays deprecated.
Covers the action submit flow end-to-end: return fail() populates both .value.failed and .error, an unread return error() logs the dev-only unhandled-error warning, and a handled error() stays quiet.
…arning Adds `unhandledErrorWarning: 'off' | 'dev' | 'all'` (default 'dev') to qwikVite, injected as a `globalThis.qWarnUnhandledErrors` define. The runtime gate is now tri-state (`flag ?? qDev`) so 'off' silences dev too and 'all' enables prod.
…rning Aligns the runtime flag name with the qwikVite `unhandledErrorWarning` option.
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
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.
What is it?
Description
Non-breaking minor.
return error(status, data)surfaces an inline, typedServerErroronloader.error/action.error;return fail()and.value.failedare deprecated but still work;throw error()keeps aborting to the global error page. Validator failures populate both channels (typed.error+ deprecatedvalue.failed). Underpinned by a core change:AsyncSignal.valueno longer throws on error state by default (read.errorinstead) — athrowOnErroropt-in will follow in a later minor via RFC.Brings actions to the same AsyncSignal surface loaders already have: adds
action.loadingandaction.promise();isRunningis deprecated in favor ofloading(still works)..value/.errorunchanged.