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

Makes performUpdate possible to call synchronously #959

Merged
merged 19 commits into from Apr 14, 2020
Merged

Conversation

sorvell
Copy link
Member

@sorvell sorvell commented Apr 13, 2020

This is somewhat related to #643. While we're not adding direct support for synchronous updates, it's now possible to create properties that perform synchronous updates by calling performUpdate in the setter.

Steven Orvell added 3 commits April 13, 2020 09:28
This can be useful to check, for example in a custom property setter.
@blikblum
Copy link

I fear this will not help #643 at all.

Basically it needs to intercept when a arbitrary, previously defined property is set / changed independently if will flush changes synchronous or not.

src/lib/updating-element.ts Outdated Show resolved Hide resolved
}

private get _hasRequestedUpdate() {
protected get isUpdatePending() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it necessary to expose this (what use case is unlocked)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No clear use case. Removing for now.

@kevinpschaaf
Copy link
Member

@blikblum As @sorvell mentioned it does not solve #643 directly, but the idea is now a user can easily make a LitElement subclass that overrides getPropertyDescriptor as added/shown in #914 so that setters for @propertys can call performUpdate synchronously after the base setter enqueues an update.

We're of the opinion that for most users, the default async/batched-render behavior is the correct default approach. However, this change should allow users with special needs for synchronous updates to be unblocked.

@sorvell sorvell merged commit 4fb9206 into master Apr 14, 2020
@sorvell sorvell deleted the performUpdate branch April 14, 2020 21:59
@blikblum
Copy link

As @sorvell mentioned it does not solve #643 directly

It does not solve #643 directly nor indirectly

However, this change should allow users with special needs for synchronous updates

#643 is not about changing the update to be synchronous. Is meant to detect synchronously when the property value changed. How LitElement reacts to this change (asynchronously or not) is irrelevant to that use case.

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

Successfully merging this pull request may close these issues.

None yet

4 participants