remove last occourence of modal
This commit is contained in:
@@ -97,7 +97,8 @@ export const data: Array<UmbMockDocumentModel> = [
|
||||
alias: 'multiNodeTreePicker',
|
||||
culture: null,
|
||||
segment: null,
|
||||
value: null,
|
||||
value:
|
||||
'all-property-editors-document-id,c05da24d-7740-447b-9cdc-bd8ce2172e38,fd56a0b5-01a0-4da2-b428-52773bfa9cc4',
|
||||
},
|
||||
{
|
||||
alias: 'datePicker',
|
||||
|
||||
@@ -72,8 +72,17 @@ export class UmbRouteContext extends UmbBaseController {
|
||||
}
|
||||
|
||||
#removeModalPath(info: IRoutingInfo) {
|
||||
if (window.location.href.includes(info.match.fragments.consumed)) {
|
||||
window.history.pushState({}, '', window.location.href.split(info.match.fragments.consumed)[0]);
|
||||
/*
|
||||
NOTICE:
|
||||
This piece of code remove the last occurrence of the modal path from the current url.
|
||||
This means if the same type of modal is opened multiple times, the url will be cleaned from the last opened modal.
|
||||
This is okay for now as we do not have any situations where we close a parent modal before a child modal.
|
||||
*/
|
||||
const currentUrl = window.location.href;
|
||||
const folderToRemove = info.match.fragments.consumed;
|
||||
if (currentUrl.includes(folderToRemove)) {
|
||||
const split = currentUrl.split(folderToRemove);
|
||||
window.history.pushState({}, '', split[split.length - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ export class UmbRouterSlotElement extends UmbLitElement {
|
||||
|
||||
const newActiveLocalPath = this.#router.match?.route.path;
|
||||
if (this._activeLocalPath !== newActiveLocalPath) {
|
||||
console.log('update', newActiveLocalPath);
|
||||
this._activeLocalPath = newActiveLocalPath;
|
||||
this.#routeContext._internal_routerGotActiveLocalPath(this._activeLocalPath);
|
||||
this.dispatchEvent(new UmbRouterSlotChangeEvent());
|
||||
|
||||
Reference in New Issue
Block a user