mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
Fix: Simplify the widget state logic (#6741)
## Summary Fixes the case where a value is updated in the graph but the result doesn't reflect on the widget representation on the relevant node. ## Changes - **What**: Uses vanilla Vue utilities instead of a special utility - **What**: Fewer places where state could be desynced. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6741-Fix-WIP-Simplify-the-widget-state-logic-2af6d73d36508160b729db50608a2ea9) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -31,7 +31,7 @@ import { assetService } from '@/platform/assets/services/assetService'
|
||||
const mockAssetServiceEligible = vi.mocked(assetService.isAssetBrowserEligible)
|
||||
|
||||
describe('WidgetSelect asset mode', () => {
|
||||
const createWidget = (): SimplifiedWidget<string | number | undefined> => ({
|
||||
const createWidget = (): SimplifiedWidget<string | undefined> => ({
|
||||
name: 'ckpt_name',
|
||||
type: 'combo',
|
||||
value: undefined,
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('WidgetSelectDropdown custom label mapping', () => {
|
||||
getOptionLabel?: (value: string | null) => string
|
||||
} = {},
|
||||
spec?: ComboInputSpec
|
||||
): SimplifiedWidget<string | number | undefined> => ({
|
||||
): SimplifiedWidget<string | undefined> => ({
|
||||
name: 'test_image_select',
|
||||
type: 'combo',
|
||||
value,
|
||||
@@ -37,8 +37,8 @@ describe('WidgetSelectDropdown custom label mapping', () => {
|
||||
})
|
||||
|
||||
const mountComponent = (
|
||||
widget: SimplifiedWidget<string | number | undefined>,
|
||||
modelValue: string | number | undefined,
|
||||
widget: SimplifiedWidget<string | undefined>,
|
||||
modelValue: string | undefined,
|
||||
assetKind: 'image' | 'video' | 'audio' = 'image'
|
||||
): VueWrapper<WidgetSelectDropdownInstance> => {
|
||||
return mount(WidgetSelectDropdown, {
|
||||
|
||||
@@ -11,7 +11,6 @@ const {
|
||||
WidgetAudioUI,
|
||||
WidgetButton,
|
||||
WidgetColorPicker,
|
||||
WidgetFileUpload,
|
||||
WidgetInputNumber,
|
||||
WidgetInputText,
|
||||
WidgetMarkdown,
|
||||
@@ -88,12 +87,6 @@ describe('widgetRegistry', () => {
|
||||
expect(getComponent('COLOR', 'color')).toBe(WidgetColorPicker)
|
||||
})
|
||||
|
||||
it('should map file types to file upload widget', () => {
|
||||
expect(getComponent('file', 'file')).toBe(WidgetFileUpload)
|
||||
expect(getComponent('fileupload', 'file')).toBe(WidgetFileUpload)
|
||||
expect(getComponent('FILEUPLOAD', 'file')).toBe(WidgetFileUpload)
|
||||
})
|
||||
|
||||
it('should map button types to button widget', () => {
|
||||
expect(getComponent('button', '')).toBe(WidgetButton)
|
||||
expect(getComponent('BUTTON', '')).toBe(WidgetButton)
|
||||
|
||||
Reference in New Issue
Block a user