History: Take URL objects into consideration when storing Backoffice history (#20986)

* fix: allows URL to be passed to navigator

* Also adds fix to Block workspace

---------

Co-authored-by: leekelleher <leekelleher@gmail.com>
This commit is contained in:
Jacob Overgaard
2025-12-01 13:29:07 +01:00
committed by GitHub
parent 820c34432a
commit 09844204b7
2 changed files with 12 additions and 6 deletions

View File

@@ -313,11 +313,14 @@ export class UmbBlockWorkspaceContext<LayoutDataType extends UmbBlockLayoutBaseM
/** /**
* Check if the workspace is about to navigate away. * Check if the workspace is about to navigate away.
* @protected * @protected
* @param {string} newUrl The new url that the workspace is navigating to. * @param {string | URL} newUrl The new url that the workspace is navigating to.
* @returns { boolean} true if the workspace is navigating away. * @returns {boolean} true if the workspace is navigating away.
* @memberof UmbEntityWorkspaceContextBase * @memberof UmbEntityWorkspaceContextBase
*/ */
protected _checkWillNavigateAway(newUrl: string): boolean { protected _checkWillNavigateAway(newUrl: string | URL): boolean {
if (newUrl instanceof URL) {
newUrl = newUrl.href;
}
return !newUrl.includes(this.routes.getActiveLocalPath()); return !newUrl.includes(this.routes.getActiveLocalPath());
} }

View File

@@ -376,11 +376,14 @@ export abstract class UmbEntityDetailWorkspaceContextBase<
/** /**
* Check if the workspace is about to navigate away. * Check if the workspace is about to navigate away.
* @protected * @protected
* @param {string} newUrl The new url that the workspace is navigating to. * @param {string | URL} newUrl The new url that the workspace is navigating to.
* @returns { boolean} true if the workspace is navigating away. * @returns {boolean} true if the workspace is navigating away.
* @memberof UmbEntityWorkspaceContextBase * @memberof UmbEntityWorkspaceContextBase
*/ */
protected _checkWillNavigateAway(newUrl: string): boolean { protected _checkWillNavigateAway(newUrl: string | URL): boolean {
if (newUrl instanceof URL) {
newUrl = newUrl.href;
}
return !newUrl.includes(this.routes.getActiveLocalPath()); return !newUrl.includes(this.routes.getActiveLocalPath());
} }