mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-31 05:19:53 +00:00
[Beta Menu] Shows unsaved state on browser tab title (#860)
* [Beta Menu] Shows unsaved state on browser tab title * Proper state management * Add playwright test * Fix browser tests
This commit is contained in:
@@ -9,6 +9,7 @@ import { ComfyAsyncDialog } from '../components/asyncDialog'
|
||||
import { trimJsonExt } from '@/utils/formatUtil'
|
||||
import type { ComfyApp } from '@/scripts/app'
|
||||
import type { ComfyComponent } from '../components'
|
||||
import { useWorkflowStore } from '@/stores/workflowStore'
|
||||
|
||||
export class ComfyWorkflowsMenu {
|
||||
#first = true
|
||||
@@ -68,7 +69,11 @@ export class ComfyWorkflowsMenu {
|
||||
this.unsaved = prop(this, 'unsaved', classList.unsaved, (v) => {
|
||||
classList.unsaved = v
|
||||
this.button.classList = classList
|
||||
setStorageValue('Comfy.PreviousWorkflowUnsaved', v)
|
||||
setStorageValue('Comfy.PreviousWorkflowUnsaved', String(v))
|
||||
|
||||
if (this.app.vueAppReady) {
|
||||
useWorkflowStore().previousWorkflowUnsaved = v
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ export function prop<T>(
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
export function getStorageValue(id) {
|
||||
export function getStorageValue(id: string) {
|
||||
const clientId = api.clientId ?? api.initialClientId
|
||||
return (
|
||||
(clientId && sessionStorage.getItem(`${id}:${clientId}`)) ??
|
||||
@@ -161,7 +161,7 @@ export function getStorageValue(id) {
|
||||
)
|
||||
}
|
||||
|
||||
export function setStorageValue(id, value) {
|
||||
export function setStorageValue(id: string, value: string) {
|
||||
const clientId = api.clientId ?? api.initialClientId
|
||||
if (clientId) {
|
||||
sessionStorage.setItem(`${id}:${clientId}`, value)
|
||||
|
||||
Reference in New Issue
Block a user