Skip to content

Commit c35d44c

Browse files
authored
[TS] Fix workflow store type assertions (#3978)
1 parent 38d3e15 commit c35d44c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/scripts/changeTracker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class ChangeTracker {
3232
/**
3333
* Whether the redo/undo restoring is in progress.
3434
*/
35-
private restoringState: boolean = false
35+
_restoringState: boolean = false
3636

3737
ds?: { scale: number; offset: [number, number] }
3838
nodeOutputs?: Record<string, any>
@@ -55,7 +55,7 @@ export class ChangeTracker {
5555
*/
5656
reset(state?: ComfyWorkflowJSON) {
5757
// Do not reset the state if we are restoring.
58-
if (this.restoringState) return
58+
if (this._restoringState) return
5959

6060
logger.debug('Reset State')
6161
if (state) this.activeState = clone(state)
@@ -124,7 +124,7 @@ export class ChangeTracker {
124124
const prevState = source.pop()
125125
if (prevState) {
126126
target.push(this.activeState)
127-
this.restoringState = true
127+
this._restoringState = true
128128
try {
129129
await app.loadGraphData(prevState, false, false, this.workflow, {
130130
showMissingModelsDialog: false,
@@ -134,7 +134,7 @@ export class ChangeTracker {
134134
this.activeState = prevState
135135
this.updateModified()
136136
} finally {
137-
this.restoringState = false
137+
this._restoringState = false
138138
}
139139
}
140140
}

src/stores/workflowStore.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class ComfyWorkflow extends UserFile {
2323
/**
2424
* Whether the workflow has been modified comparing to the initial state.
2525
*/
26-
private _isModified: boolean = false
26+
_isModified: boolean = false
2727

2828
/**
2929
* @param options The path, modified, and size of the workflow.
@@ -131,7 +131,7 @@ export interface WorkflowStore {
131131
activeWorkflow: LoadedComfyWorkflow | null
132132
isActive: (workflow: ComfyWorkflow) => boolean
133133
openWorkflows: ComfyWorkflow[]
134-
openedWorkflowIndexShift: (shift: number) => LoadedComfyWorkflow | null
134+
openedWorkflowIndexShift: (shift: number) => ComfyWorkflow | null
135135
openWorkflow: (workflow: ComfyWorkflow) => Promise<LoadedComfyWorkflow>
136136
openWorkflowsInBackground: (paths: {
137137
left?: string[]
@@ -477,7 +477,7 @@ export const useWorkflowStore = defineStore('workflow', () => {
477477
isSubgraphActive,
478478
updateActiveGraph
479479
}
480-
}) as () => WorkflowStore
480+
}) satisfies () => WorkflowStore
481481

482482
export const useWorkflowBookmarkStore = defineStore('workflowBookmark', () => {
483483
const bookmarks = ref<Set<string>>(new Set())

0 commit comments

Comments
 (0)