-
Notifications
You must be signed in to change notification settings - Fork 878
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
[lit-html] Add dev mode warning when static values are detected in non static templates #4345
Conversation
🦋 Changeset detectedLatest commit: 7b858da The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummary⏳ Benchmarks are currently running. Results below are out of date. nop-update
render
update
update-reflect
Results⏳ Benchmarks are currently running. Results below are out of date. this-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
The size of lit-html.js and lit-core.min.js are as expected. |
So, more that I think about this some more, I'm not sure if this is the right check. Static values are just strings that are tagged so we can differentiate them in static templates. They actually could be usable in regular templates if used in allowed binding positions. So checks for disallowed binding positions should suffice. In those we could suggest static templates. The question is if we need to do anything to support static values, it of doing so would be confusing. @rictic ? |
Co-authored-by: Augustine Kim <augustinekim@google.com>
Fixes #4332
Why
Given:
The example ends up rendering attribute="[object Object]", when it should throw a dev mode warning.
Fix
Check that values do not have
_$litStatic$
and raise a dev mode warning if the key is present.New warning is: