Core: Minimize await to a single JS cycle (refactor #21186)#22074
Merged
nielslyngsoe merged 10 commits intomainfrom Mar 10, 2026
Merged
Core: Minimize await to a single JS cycle (refactor #21186)#22074nielslyngsoe merged 10 commits intomainfrom
nielslyngsoe merged 10 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors several disconnect/deferred-destruction paths to avoid waiting a full rendering frame, using a single JS-cycle (microtask) cancellation pattern instead. This supports the extension slot lifecycle behavior needed during DOM moves/sorting (continuation of #21186).
Changes:
- Replaced
requestAnimationFrame-based disconnect debouncing with a microtask (Promise.resolve().then(...)) +AbortControllercancellation in multiple components. - Updated extension slot elements to cancel pending teardown on reconnect using the new AbortController pattern.
- Refactored
UmbContextConsumerdisconnect handling and “listening scope” management to align with the new single-cycle behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/core/lit-element/directives/destroy.lit-directive.ts | Switches directive teardown deferral from rAF to microtask + AbortController. |
| src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/components/extension-with-api-slot/extension-with-api-slot.element.ts | Updates deferred controller destruction to microtask + AbortController cancellation. |
| src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/components/extension-slot/extension-slot.element.ts | Updates deferred destruction/event listener cleanup to microtask + AbortController cancellation. |
| src/Umbraco.Web.UI.Client/src/libs/context-api/consume/context-consumer.ts | Refactors disconnect cancellation and current “scope” event listening to avoid rAF usage. |
src/Umbraco.Web.UI.Client/src/libs/context-api/consume/context-consumer.ts
Show resolved
Hide resolved
...ore/extension-registry/components/extension-with-api-slot/extension-with-api-slot.element.ts
Show resolved
Hide resolved
madsrasmussen
approved these changes
Mar 10, 2026
This was referenced Apr 2, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Minimize the disconnect-debounce to use a single JS cycle instead of a whole rendering frame.
Refactor / continued work of #21186