-
Notifications
You must be signed in to change notification settings - Fork 27
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
Improve errors for read-only array mutations #63
Conversation
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.
LGTM, just a small nit about isArray
.
8d6d95d
to
ee66383
Compare
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.
Nit on formatting, haven't reviewed the logic
ee66383
to
7d17e6c
Compare
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.
LGTM
This PR addresses the unhelpful error message discussed in salesforce/lwc#1739, when an attempt is made at mutating a read-only array. Some discussion seems to have occurred offline that wasn't captured in the issue, so the preferred solution wasn't readily apparent. Pinging @apapko @pmdartus @caridy since they previously weighed in.
Before, if someone attempted to mutate a read-only array (using the LWC
@api
decorator, for example), they would be presented with the following error:The error now reads:
The change addresses the specific concern that was raised but may be insufficient to address larger, related DX concerns. Still, this seemed a reasonable resolution and submitting a PR seemed the easiest to facilitate discussion. Happy to go in a different direction if that is preferred.