Umbraco.CMS.Backoffice icon indicating copy to clipboard operation
Umbraco.CMS.Backoffice copied to clipboard

Fixes with `umb-route-slot` inside routed modal

Open enkelmedia opened this issue 7 months ago • 2 comments

Description

This provides a potential fix for the issue described here: https://github.com/umbraco/Umbraco-CMS/issues/16834

I'm thinking that the problem might be that the event that is fired when the route changes fires before the umb-route-slot inside the modal has been loaded. I tried some hacks with setTimeout to trigger the "routes"-attribute to re-load the routes in the modal. This worked so i figured that maybe if we set the routes of the underlying router-slot when a new route is loaded it might solve the problem.

I made a small change to the firstUpdated method of UmbRouterSlotElement and after this, the scenario that I was having trouble with works.

umb-issue-routes-fix

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Motivation and context

How to test?

I've also added a example-folder to the PR, so just run

npm run example

And pick modal routed

Checklist

  • [x] If my change requires a change to the documentation, I have updated the documentation in this pull request.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.

enkelmedia avatar Jul 27 '24 14:07 enkelmedia