Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix audio widget serialize option #910

Merged
merged 1 commit into from
Sep 22, 2024
Merged

Fix audio widget serialize option #910

merged 1 commit into from
Sep 22, 2024

Conversation

christian-byrne
Copy link
Collaborator

Closes #866.

serialize should be on options property of widget.

interface IWidget<TValue = any, TOptions = any> {

export interface DOMWidget<T = HTMLElement> {

// Store all widget values
if (widgets) {
for (const i in widgets) {
const widget = widgets[i]
if (!widget.options || widget.options.serialize !== false) {
inputs[widget.name] = widget.serializeValue
? await widget.serializeValue(node, i)
: widget.value
}
}
}

API Workflow before:

{
  "15": {
    "inputs": {
      "audio": "song.mp3",
      "upload": ""
    },
    "class_type": "LoadAudio",
    "_meta": {
      "title": "LoadAudio"
    }
  }
}

API Workflow after:

{
  "15": {
    "inputs": {
      "audio": "song.mp3"
    },
    "class_type": "LoadAudio",
    "_meta": {
      "title": "LoadAudio"
    }
  }
}

@huchenlei huchenlei merged commit a15c4d1 into main Sep 22, 2024
9 checks passed
@christian-byrne christian-byrne deleted the audio-widget-serialize branch September 22, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

widget.serialize isn't part of the API, these should be widget.serializeValue = () => {}
2 participants