-
Notifications
You must be signed in to change notification settings - Fork 398
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
fix(ssr): update wire adapter validation @ W-17274788 #4910
Conversation
const { decorators } = node; | ||
|
||
if (decorators.length > 1) { | ||
throw new Error('todo - multiple decorators at once'); |
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.
TODO: Fix these error messages.
path: NodePath<PropertyDefinition | MethodDefinition> | ||
): asserts config is NoSpreadObjectExpression { | ||
if (!is.objectExpression(config)) { | ||
throw new Error('todo - CONFIG_OBJECT_SHOULD_BE_SECOND_PARAMETER'); |
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.
TODO: add fixtures validating all the error messages
throw new Error('Invalid config provided to @wire decorator; expected an object literal.'); | ||
for (const property of config.properties) { | ||
// Only validate computed object properties because static props are all valid | ||
// and we ignore {...spreads} and {methods(){}} |
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.
TODO: add a test for spreads.
__connectContext(${/*wire adapter constructor*/ 0}, instance, (newContextValue) => { | ||
const wireConfigObj = ${/*mapping from lwc fields to wire config keys*/ 2}; | ||
wireInstance.update(wireConfigObj, newContextValue); | ||
wireInstance.update(getLiveConfig(), newContextValue); |
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.
TODO: add a test for this being two different live values across two updates, to ensure in the future we don't mistakenly just set the variable once.
Details
The original wire adapter implementation made some incorrect assumptions (e.g. all values look like
"$string"
); this PR updates the logic to better matchengine-server
.Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item