Skip to content

Fix: #18707#18859

Merged
nielslyngsoe merged 12 commits intov15/devfrom
v15/bugfix/18707
Mar 31, 2025
Merged

Fix: #18707#18859
nielslyngsoe merged 12 commits intov15/devfrom
v15/bugfix/18707

Conversation

@nielslyngsoe
Copy link
Copy Markdown
Member

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.

Copilot AI review requested due to automatic review settings March 28, 2025 12:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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();

nielslyngsoe and others added 4 commits March 28, 2025 13:57
…nsion.registry.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…try/extension.registry.test.ts"

This reverts commit b8d1dd7.
@nielslyngsoe nielslyngsoe enabled auto-merge (squash) March 28, 2025 13:22
nielslyngsoe and others added 5 commits March 31, 2025 10:06
# 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 madsrasmussen added release/15.4.0 type/bug category/dx Developer experience category/ux User experience and removed category/dx Developer experience labels Mar 31, 2025
@nielslyngsoe nielslyngsoe merged commit d978a10 into v15/dev Mar 31, 2025
22 of 23 checks passed
@nielslyngsoe nielslyngsoe deleted the v15/bugfix/18707 branch March 31, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants