Consistently use -1 for temporary file size (#1464)

This commit is contained in:
Chenlei Hu
2024-11-07 23:34:46 -05:00
committed by GitHub
parent 6b6992591b
commit dd192777b7
4 changed files with 6 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ export class UserFile {
}
get isTemporary() {
return this.size === 0
return this.size === -1
}
get isPersisted() {

View File

@@ -215,7 +215,7 @@ export const useWorkflowStore = defineStore('workflow', () => {
const workflow = new ComfyWorkflow({
path: fullPath,
modified: Date.now(),
size: 0
size: -1
})
workflow.originalContent = workflow.content = workflowData

View File

@@ -191,7 +191,9 @@ describe('useUserFileStore', () => {
expect(api.storeUserData).toHaveBeenCalledWith(
'newfile.txt',
'file content',
{ throwOnError: true, full_info: true, overwrite: true }
// SaveAs should create a new temporary file, which will mean
// overwrite is false
{ throwOnError: true, full_info: true, overwrite: false }
)
expect(newFile).toBeInstanceOf(UserFile)
expect(newFile.path).toBe('newfile.txt')

View File

@@ -25,7 +25,7 @@ describe('useWorkflowStore', () => {
filenames.map((filename) => ({
path: filename,
modified: new Date().toISOString(),
size: 1 // size !== 0 for remote workflows
size: 1 // size !== -1 for remote workflows
}))
)
return await store.syncWorkflows()