@@ -603,7 +603,7 @@ export abstract class UpdatingElement extends HTMLElement {
603
603
}
604
604
}
605
605
if ( ! this . _hasRequestedUpdate && shouldRequestUpdate ) {
606
- this . _enqueueUpdate ( ) ;
606
+ this . _updatePromise = this . _enqueueUpdate ( ) ;
607
607
}
608
608
}
609
609
@@ -628,26 +628,24 @@ export abstract class UpdatingElement extends HTMLElement {
628
628
/**
629
629
* Sets up the element to asynchronously update.
630
630
*/
631
- private _enqueueUpdate ( ) {
631
+ private async _enqueueUpdate ( ) {
632
632
this . _updateState = this . _updateState | STATE_UPDATE_REQUESTED ;
633
- this . _updatePromise = ( async ( ) => {
634
- try {
635
- // Ensure any previous update has resolved before updating.
636
- // This `await` also ensures that property changes are batched.
637
- await this . _updatePromise ;
638
- } catch ( e ) {
639
- // Ignore any previous errors. We only care that the previous cycle is
640
- // done. Any error should have been handled in the previous update.
641
- }
642
- const result = this . performUpdate ( ) ;
643
- // If `performUpdate` returns a Promise, we await it. This is done to
644
- // enable coordinating updates with a scheduler. Note, the result is
645
- // checked to avoid delaying an additional microtask unless we need to.
646
- if ( result != null ) {
647
- await result ;
648
- }
649
- return ! this . _hasRequestedUpdate ;
650
- } ) ( ) ;
633
+ try {
634
+ // Ensure any previous update has resolved before updating.
635
+ // This `await` also ensures that property changes are batched.
636
+ await this . _updatePromise ;
637
+ } catch ( e ) {
638
+ // Ignore any previous errors. We only care that the previous cycle is
639
+ // done. Any error should have been handled in the previous update.
640
+ }
641
+ const result = this . performUpdate ( ) ;
642
+ // If `performUpdate` returns a Promise, we await it. This is done to
643
+ // enable coordinating updates with a scheduler. Note, the result is
644
+ // checked to avoid delaying an additional microtask unless we need to.
645
+ if ( result != null ) {
646
+ await result ;
647
+ }
648
+ return ! this . _hasRequestedUpdate ;
651
649
}
652
650
653
651
private get _hasRequestedUpdate ( ) {
0 commit comments