Skip to content
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

ifDefined documentation updates for Lit 2 #659

Closed
AndrewJakubowicz opened this issue Jan 21, 2022 · 1 comment
Closed

ifDefined documentation updates for Lit 2 #659

AndrewJakubowicz opened this issue Jan 21, 2022 · 1 comment

Comments

@AndrewJakubowicz
Copy link
Contributor

AndrewJakubowicz commented Jan 21, 2022

Note: TODO - The behavior is much more subtle. It's an initial render that creates the behavior difference. After that ifDefined is indeed a noop. See this repro: https://lit.dev/playground/?mods=gists#gist=7ecdc1acf63b0f249e6e582fb8a526aa

Context

The documentation currently states that using ifDefined on something that isn't an attribute part is a no-op, however at runtime ifDefined correctly shows the property default, whilst undefined doesn't. This contradicts that it is a no-op.

There was a change in behavior between Lit 1 and Lit 2 with the ifDefined directive, where some previously no-op behavior is now valid usage. See runem/lit-analyzer#223 for more details.

There are 3 places where ifDefined needs to be updated:

  1. In the Lit Analyzer repo: Confusing ifDefined extension error when author wants default property fallback behavior runem/lit-analyzer#223
  2. Generated JSDoc (related to [all] Expand jsdoc documentation lit#1883 (comment))
  3. Website directive docs
    1. Directives list
    2. Built in Directives

Completion criteria

  • Update lit.dev documentation. Other places to update are mentioned for completeness.
@AndrewJakubowicz
Copy link
Contributor Author

Closing this issue as ifDefined is a red herring. The tricky nuance is in how nothing behaves in reactive property updates.

It's an initial render that creates the behavior difference. After that ifDefined is indeed a noop. See this repro: https://lit.dev/playground/?mods=gists#gist=7ecdc1acf63b0f249e6e582fb8a526aa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant