mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 20:51:58 +00:00
fix: call checkState after image input changes for proper undo tracking (#9623)
## Summary Image input changes (dropdown selection and file upload) in app/linear mode did not create their own undo entries, causing undo to skip or bundle image changes with subsequent actions. ## Changes - **What**: Add explicit `checkState()` calls in `WidgetSelectDropdown.vue` after `modelValue` is set in `updateSelectedItems()` (dropdown selection) and `handleFilesUpdate()` (file upload), ensuring each image change gets its own undo entry. ## Review Focus The fix is intentionally scoped to `WidgetSelectDropdown` rather than the generic `updateHandler` in `NodeWidgets.vue`, which would create excessive undo entries for text inputs. The pattern follows existing usage in `useSelectedNodeActions.ts` and other composables. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9623-fix-call-checkState-after-image-input-changes-for-proper-undo-tracking-31d6d73d3650814781dbca5db459ab6d) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
getAssetFilename
|
||||
} from '@/platform/assets/utils/assetMetadataUtils'
|
||||
import { useToastStore } from '@/platform/updates/common/toastStore'
|
||||
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
|
||||
import FormDropdown from '@/renderer/extensions/vueNodes/widgets/components/form/dropdown/FormDropdown.vue'
|
||||
import type {
|
||||
FilterOption,
|
||||
@@ -376,6 +377,7 @@ function updateSelectedItems(selectedItems: Set<string>) {
|
||||
return
|
||||
}
|
||||
modelValue.value = name
|
||||
useWorkflowStore().activeWorkflow?.changeTracker?.checkState()
|
||||
}
|
||||
|
||||
const uploadFile = async (
|
||||
@@ -450,6 +452,9 @@ async function handleFilesUpdate(files: File[]) {
|
||||
if (props.widget.callback) {
|
||||
props.widget.callback(uploadedPaths[0])
|
||||
}
|
||||
|
||||
// 5. Snapshot undo state so the image change gets its own undo entry
|
||||
useWorkflowStore().activeWorkflow?.changeTracker?.checkState()
|
||||
} catch (error) {
|
||||
console.error('Upload error:', error)
|
||||
toastStore.addAlert(`Upload failed: ${error}`)
|
||||
|
||||
Reference in New Issue
Block a user