-
Notifications
You must be signed in to change notification settings - Fork 400
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(wire-service): error with invalid adapter id #475
fix(wire-service): error with invalid adapter id #475
Conversation
Benchmark resultsBase commit: lwc-engine-benchmark
|
747e58c
to
cf26759
Compare
In non-prod mode, throw an error when the adapter is is invalid: non-truthy or unregistered
cf26759
to
9a7d2be
Compare
Benchmark resultsBase commit: lwc-engine-benchmark
|
Benchmark resultsBase commit: lwc-engine-benchmark
|
if (process.env.NODE_ENV !== 'production') { | ||
assert.isTrue(wireDef.adapter, `@wire on "${wireTarget}": adapter id must be truthy`); | ||
assert.isTrue(adapterFactory, `@wire on "${wireTarget}": unknown adapter id: ${String(wireDef.adapter)}`); | ||
} |
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.
This is the real change: in non-prod, assert adapter id is truthy and registered (so adapterFactory exists)
if (process.env.NODE_ENV !== 'production') { | ||
assert.isTrue(adapterId, 'adapter id must be truthy'); | ||
assert.isTrue(typeof adapterFactory === 'function', 'adapter factory must be a callable'); | ||
} |
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.
Move existing asserts under mode check so they're removed in prod
assert.isFalse(connectedListeners.includes(listener as NoArgumentListener), 'must not call addEventListener("connect") with the same listener'); | ||
if (process.env.NODE_ENV !== 'production') { | ||
assert.isFalse(connectedListeners.includes(listener as NoArgumentListener), 'must not call addEventListener("connect") with the same listener'); | ||
} |
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.
Same with these existing asserts
Does this PR introduce a breaking change?