fix(ssr): remove dev-only accessor warnings #5135
Open
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.
Details
This is a step towards fixing #5134 and #5123. It removes some dev-only accessors when running in SSR mode.
The problem here is multi-fold. First off, this filter:
lwc/packages/@lwc/engine-core/src/framework/base-bridge-element.ts
Line 169 in 095a777
...basically does nothing in SSR, because
HTMLElementPrototype
is empty:lwc/packages/@lwc/engine-core/src/framework/html-element.ts
Lines 9 to 10 in 095a777
So this causes us to always add dev-only accessors for e.g.
title
,tabIndex
, etc.Next up, the renderer does an
in
check here:lwc/packages/@lwc/engine-server/src/renderer.ts
Line 192 in 095a777
This is always true for
title
,tabIndex
, etc., since the accessors were added in dev mode. So this leads totitle
/tabIndex
/etc. differing between SSR and CSR (or between prod mode and dev mode).In general, I'm starting to wonder if these dev-only accessors are even worth it anymore – they've caused a lot of headaches, and the only value is that you get a nice warning when you forget to add an
@api
. But for now we can at least disable them in SSR.Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item