-
Notifications
You must be signed in to change notification settings - Fork 4
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
Minor release #23
Minor release #23
Conversation
…nal are now recomputed when the source signal changes.
… "identifier" property
@cesarParra Reviewing it |
…e `peek` function.
# Conflicts: # README.md # src/lwc/signals/__tests__/computed.test.ts # src/lwc/signals/__tests__/effect.test.ts # src/lwc/signals/core.ts
Improved error handling
…tifier as an argument
} | ||
}; | ||
|
||
// We don't want to expose the `get` and `set` methods, so | ||
// remove before returning | ||
delete returnValue.get; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are about to reach the point were it might make sense to put the properties to remove in an array and delete them in a loop. Just something to consider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I have an issue to fix this ugliness already #27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good, left you a small comment on a potential improvement but you can leave it as is
🎉 This PR is included in version 1.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Next minor release.
Contains:
Improved error handling
Improves the error handling experience by providing a couple of features to debug and/or modify the way errors are handled when issues occur in a
$computed
or an$effect
Errors are now surfaced as a
console.error
by defaultBefore, when an error occurred in a computed or an effect, the exception was rethrown. The issue is that Salesforce handles these exceptions differently based on the environment. For example, LWC debugging might be on/off, which changes how errors are surfaced, and errors are handled differently in LWR templates, where the user is redirected to the
error
page.To improve this experience, when an error occurs in either a computed or effect function, a console.error will be called so that the error is easier to detect (the exception will still be retrhwon after logging).
Computed and effects can now have an "identifier" for logging purposes.
Following on the previous improvement, if you want to pinpoint exactly which effect or which computed values is the one throwing the exception, a new
identifier
property was introduced. This is only for debugging purposes, and does not affect the functionality otherwise.Example
In this example, the
test-identifier
string will appear as part of theconsole.error
message.Computed and effects can now have custom error handlers
Both computed and effect signals can receive a custom
errorHandler
property, that allows developers to completely override the default functionality that logs and rethrows the error.Effect handlers
For
$effect
handlers, you can pass a function with the following shape:The thrown error will be passed as an argument, and nothing should be returned.
Example:
Computed handlers
For
$computed
handlers, you can pass a function with the following shape:Where you can return nothing, or a value of type
T
, which should be of the same type as the computed value itself. This allows you to provide a "fallback" value, that the computed value will receive in case of errors.Example
Suite of additional unit tests
Other minor fixes and improvements