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

updateComplete should not resolve until the element has connected #594

Closed
kevinpschaaf opened this issue Feb 26, 2019 · 1 comment · Fixed by #606
Closed

updateComplete should not resolve until the element has connected #594

kevinpschaaf opened this issue Feb 26, 2019 · 1 comment · Fixed by #606

Comments

@kevinpschaaf
Copy link
Member

Description

If an element is created but not yet connected, and no property has been set to enqueue an update, updateComplete currently resolves immediately (before the first render), rather than waiting until connection. However, if at least one property has been set, it will wait until connection before resolving. This is confusing and appears to be a bug.

Since an element will render unconditionally upon connection (regardless of whether it has properties that triggered rendering), the mental model should be that a newly constructed but disconnected element should be in a "pending update" state until it is connected. Hence updateComplete should not resolve until the element has first connected.

Live Demo

https://jsbin.com/jiquhez/edit?html,console,output

Steps to Reproduce

  1. Open link above

Expected Results

Found 1 element // result of `getItems` before connection
Found 1 element // result of `getItems` after connection

Actual Results

Found 0 element` // result of `getItems` before connection
Found 1 element` // result of `getItems` after connection

Browsers Affected

  • All

Versions

  • lit-element: 2.0.1
@dorivaught dorivaught added this to the 2.0.x milestone Mar 4, 2019
sorvell pushed a commit that referenced this issue Mar 12, 2019
…ack`

Fixes #594. Ensures an early access of `updateComplete` will not complete before the element has first updated (at connection time).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants