Open
Conversation
* Support Promise as input value; * The generator callback now has the second argument, `callbacks`. It contains an object with callbacks `success` and `error` - the observable you provide to `createEffect()` can use them to notify the effect caller; * The second argument of `createEffect()` got new fields: * * `onSuccess?: (v?: unknown) => void` - will be called when `callbacks.success` is called; * * `onError?: (v?: unknown) => void` - will be called when `callbacks.error` is called; * * `onFinalize?: () => void` - will be called when either `callbacks.success` or `callbacks.error` is called; * When a signal is passed to the function created by `createEffect()`, the effect handler is called synchronously and will not be called again with the same value (equal by reference, `===`) when the underlying `effect()` is executed. BREAKING CHANGE: Previously, `createEffect()` would re-subscribe when the effect's handler threw an error, and when the observable passed to the handler threw an error. Now it will only re-subscribe to the handler. If a passed observable throws an error, the effect will not re-subscribe to that observable - you will need to call the effect again. Re-subscribing to an observable that is in an error state might cause endless loops and unexpected behavior.
…was "swallowing" errors. Now the error will be printed to the console in dev mode, and the `onError()` callback will be called.
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.
callbacks. It contains an object with callbackssuccessanderror- the observable you provide tocreateEffect()can use them to notify the effect caller;createEffect()accepts the second argument with fields:onSuccess?: (v?: unknown) => void- will be called whencallbacks.successis called;onError?: (v?: unknown) => void- will be called whencallbacks.erroris called;onFinalize?: () => void- will be called when eithercallbacks.successorcallbacks.erroris called;createEffect(), the effect handler is called synchronously and will not be called again with the same value (equal by reference,===) when the underlyingeffect()is executed.asObservable()method of the created effect.Example:
createEffect()with default options (with retry on errors allowed) was "swallowing" errors. Now the error will be printed to the console in dev mode, and theonError()callback will be called.BREAKING CHANGE:
Previously,
createEffect()would re-subscribe when the effect's handler threw an error, and when the observable passed to the handler threw an error. Now it will only re-subscribe to the handler. If a passed observable throws an error, the effect will not re-subscribe to that observable - you will need to call the effect again. Re-subscribing to an observable that is in an error state might cause endless loops and unexpected behavior.This change could be considered a bugfix, but if some app was relying on the previous behavior - even if it was erroneous - it would technically be a breaking change for that app.