-
Notifications
You must be signed in to change notification settings - Fork 393
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): fix rendering of class
attribute
#4805
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.
I get the intention behind writing renderAttrs
twice, but I figured we can just write it once using string concatenation and then share the impl for both yield
and no-yield
flavor. No-yield
is probably going away soon anyway.
} | ||
throw new Error(`Unimplemented child attr IR node type: ${value.type}`); | ||
}) | ||
.filter(Boolean) as EsProperty[]; |
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.
.filter(Boolean) as EsProperty[]; | |
.filter(<T>(v: T): v is NonNullable<T> => v) |
I thiiink this works?
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.
I think this is actually less clear than the previous version. It's a shame TS doesn't understand .filter(Boolean)
.
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.
.filter(Boolean) as EsProperty[]; | |
.filter(v => v is EsProperty => Boolean(v)); |
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.
Didn't work. I'm not going to fight TypeScript on this one
'attribute-class/with-scoped-styles/dynamic/index.js', | ||
'attribute-class/with-scoped-styles/static/index.js', |
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.
We need to implement template class binding: salesforce/lwc-rfcs#87
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.
…omponent.ts Co-authored-by: Will Harney <[email protected]>
…ormers/component.ts" This reverts commit 8adf666.
Details
Fixes a couple tests for rendering the
class
attribute. We weren't correctly handling the scope token in a number of places, including:class
contains spaces, tabs, etc.I also added some more tests to handle more edge cases.
Before: 154 passed out of 199
After: 158 passed out of 203
(Two of the newly-added tests are failing due to #4802.)
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?