From c35d44c4917c368a7edb2f664cd07b93d6380fbf Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Mon, 26 May 2025 05:39:30 +1000 Subject: [PATCH] [TS] Fix workflow store type assertions (#3978) --- src/scripts/changeTracker.ts | 8 ++++---- src/stores/workflowStore.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scripts/changeTracker.ts b/src/scripts/changeTracker.ts index bd0305bf2..30c2f3289 100644 --- a/src/scripts/changeTracker.ts +++ b/src/scripts/changeTracker.ts @@ -32,7 +32,7 @@ export class ChangeTracker { /** * Whether the redo/undo restoring is in progress. */ - private restoringState: boolean = false + _restoringState: boolean = false ds?: { scale: number; offset: [number, number] } nodeOutputs?: Record @@ -55,7 +55,7 @@ export class ChangeTracker { */ reset(state?: ComfyWorkflowJSON) { // Do not reset the state if we are restoring. - if (this.restoringState) return + if (this._restoringState) return logger.debug('Reset State') if (state) this.activeState = clone(state) @@ -124,7 +124,7 @@ export class ChangeTracker { const prevState = source.pop() if (prevState) { target.push(this.activeState) - this.restoringState = true + this._restoringState = true try { await app.loadGraphData(prevState, false, false, this.workflow, { showMissingModelsDialog: false, @@ -134,7 +134,7 @@ export class ChangeTracker { this.activeState = prevState this.updateModified() } finally { - this.restoringState = false + this._restoringState = false } } } diff --git a/src/stores/workflowStore.ts b/src/stores/workflowStore.ts index ac6185968..105eeadb0 100644 --- a/src/stores/workflowStore.ts +++ b/src/stores/workflowStore.ts @@ -23,7 +23,7 @@ export class ComfyWorkflow extends UserFile { /** * Whether the workflow has been modified comparing to the initial state. */ - private _isModified: boolean = false + _isModified: boolean = false /** * @param options The path, modified, and size of the workflow. @@ -131,7 +131,7 @@ export interface WorkflowStore { activeWorkflow: LoadedComfyWorkflow | null isActive: (workflow: ComfyWorkflow) => boolean openWorkflows: ComfyWorkflow[] - openedWorkflowIndexShift: (shift: number) => LoadedComfyWorkflow | null + openedWorkflowIndexShift: (shift: number) => ComfyWorkflow | null openWorkflow: (workflow: ComfyWorkflow) => Promise openWorkflowsInBackground: (paths: { left?: string[] @@ -477,7 +477,7 @@ export const useWorkflowStore = defineStore('workflow', () => { isSubgraphActive, updateActiveGraph } -}) as () => WorkflowStore +}) satisfies () => WorkflowStore export const useWorkflowBookmarkStore = defineStore('workflowBookmark', () => { const bookmarks = ref>(new Set())