mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 02:06:42 +00:00
Don't add toast to history (#8915)
This commit is contained in:
parent
a43120320e
commit
aaa50b4d1d
@ -45,7 +45,8 @@ export const showDialog = async (
|
||||
root: ShadowRoot | HTMLElement,
|
||||
dialogTag: string,
|
||||
dialogParams: unknown,
|
||||
dialogImport?: () => Promise<unknown>
|
||||
dialogImport?: () => Promise<unknown>,
|
||||
addHistory = true
|
||||
) => {
|
||||
if (!(dialogTag in LOADED)) {
|
||||
if (!dialogImport) {
|
||||
@ -59,6 +60,7 @@ export const showDialog = async (
|
||||
});
|
||||
}
|
||||
|
||||
if (addHistory) {
|
||||
history.replaceState(
|
||||
{
|
||||
dialog: dialogTag,
|
||||
@ -82,7 +84,7 @@ export const showDialog = async (
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
const dialogElement = await LOADED[dialogTag];
|
||||
dialogElement.showDialog(dialogParams);
|
||||
};
|
||||
|
@ -8,6 +8,7 @@ interface RegisterDialogParams {
|
||||
dialogShowEvent: keyof HASSDomEvents;
|
||||
dialogTag: keyof HTMLElementTagNameMap;
|
||||
dialogImport: () => Promise<unknown>;
|
||||
addHistory?: boolean;
|
||||
}
|
||||
|
||||
declare global {
|
||||
@ -38,6 +39,7 @@ export const dialogManagerMixin = <T extends Constructor<HassBaseEl>>(
|
||||
dialogShowEvent,
|
||||
dialogTag,
|
||||
dialogImport,
|
||||
addHistory = true,
|
||||
}: RegisterDialogParams) {
|
||||
this.addEventListener(dialogShowEvent, (showEv) => {
|
||||
showDialog(
|
||||
@ -45,7 +47,8 @@ export const dialogManagerMixin = <T extends Constructor<HassBaseEl>>(
|
||||
this.shadowRoot!,
|
||||
dialogTag,
|
||||
(showEv as HASSDomEvent<unknown>).detail,
|
||||
dialogImport
|
||||
dialogImport,
|
||||
addHistory
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
||||
dialogShowEvent: "hass-notification",
|
||||
dialogTag: "notification-manager",
|
||||
dialogImport: () => import("../managers/notification-manager"),
|
||||
addHistory: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user