Merged
Conversation
# Conflicts: # src/Umbraco.Web.UI.Client/src/apps/backoffice/backoffice.context.ts
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes two issues: ensuring that late-coming condition changes are taken into account in the extension registry and updating the router when a navigation candidate is already set. It also refactors the section context and backoffice context initialization, updates memoization functions in the extension registry, and adapts tests accordingly.
- Updated the section context to extend a base class and require a controller host.
- Enhanced memoization in the extension registry to account for dynamic conditions.
- Adjusted router and backoffice routing logic along with corresponding tests.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/core/section/section.context.ts | Updated class inheritance and constructor to utilize a controller host |
| src/Umbraco.Web.UI.Client/src/libs/extension-api/registry/extension.registry.ts | Modified memoization functions to consider condition arrays and updated extension replacement logic |
| src/Umbraco.Web.UI.Client/src/libs/extension-api/registry/extension.registry.test.ts | Updated tests to clear the registry after each run and removed awaits from synchronous calls |
| src/Umbraco.Web.UI.Client/src/external/router-slot/router-slot.ts | Adjusted route matching logic for proper navigation triggering |
| src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-main.element.ts | Refactored route generation and section context creation in the backoffice component |
| src/Umbraco.Web.UI.Client/src/apps/backoffice/backoffice.context.ts | Switched from an async initializer to context consumption for allowed sections updates |
Comments suppressed due to low confidence (1)
src/Umbraco.Web.UI.Client/src/external/router-slot/router-slot.ts:209
- [nitpick] Commented out assignment to 'navigate' may lead to cases where navigation isn't triggered when a new route match is detected. Verify that the new route matching logic correctly updates the 'navigate' flag as intended.
const newMatch = this.getRouteMatch();
src/Umbraco.Web.UI.Client/src/libs/extension-api/registry/extension.registry.test.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-main.element.ts
Show resolved
Hide resolved
…nsion.registry.test.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…try/extension.registry.test.ts" This reverts commit b8d1dd7.
# Conflicts: # src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-main.element.ts # src/Umbraco.Web.UI.Client/src/packages/core/section/section.context.ts
madsrasmussen
approved these changes
Mar 31, 2025
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.
Fixes #18707 (comment)
Actually, this covers two issues:
A.
The extension registry observable did not take conditions into account, meaning late coming conditions were not re-evaluated. This was originally thought to be unnesecary to ensure Conditions was present before the extension would be needed. But this case shows one example of where a race conditions could happen, meaning we want to react to the change even if it's late to the show.
B.
The Router did not update if it already had found a good candidate for it self. This means that, in combination with the above, the route would never go away again if it first got through.