Skip to content

Commit 26e9236

Browse files
committed
feat: Auto-refresh assets on file upload
- Integrate AssetsStore with useNodeImageUpload - Automatically update input assets when uploading to input folder - Support drag & drop, paste, and file selection Solution 2 complete: Real-time assets sync with upload triggers Related: #6112 code review feedback applied
1 parent 7383c0f commit 26e9236

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/composables/node/useNodeImageUpload.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
55
import { useToastStore } from '@/platform/updates/common/toastStore'
66
import type { ResultItemType } from '@/schemas/apiSchema'
77
import { api } from '@/scripts/api'
8+
import { useAssetsStore } from '@/stores/assetsStore'
89

910
const PASTED_IMAGE_EXPIRY_MS = 2000
1011

@@ -37,6 +38,13 @@ const uploadFile = async (
3738
}
3839

3940
const data = await resp.json()
41+
42+
// Update AssetsStore input assets when files are uploaded to input folder
43+
if (formFields.type === 'input' || (!formFields.type && !isPasted)) {
44+
const assetsStore = useAssetsStore()
45+
await assetsStore.updateInputs()
46+
}
47+
4048
return data.subfolder ? `${data.subfolder}/${data.name}` : data.name
4149
}
4250

0 commit comments

Comments
 (0)