From e0d61b8baa0f6293f53b9bdb1647d42f9ae2583a Mon Sep 17 00:00:00 2001 From: Dawood Khan Date: Mon, 18 Sep 2023 19:06:52 -0400 Subject: [PATCH] Fix `.clear()` events for audio and image (#5587) * clear * add changeset --------- Co-authored-by: gradio-pr-bot --- .changeset/better-dingos-find.md | 7 +++++++ js/audio/interactive/InteractiveAudio.svelte | 2 ++ js/image/interactive/Image.svelte | 1 + 3 files changed, 10 insertions(+) create mode 100644 .changeset/better-dingos-find.md diff --git a/.changeset/better-dingos-find.md b/.changeset/better-dingos-find.md new file mode 100644 index 0000000000..e921ee2b8f --- /dev/null +++ b/.changeset/better-dingos-find.md @@ -0,0 +1,7 @@ +--- +"@gradio/audio": patch +"@gradio/image": patch +"gradio": patch +--- + +fix:Fix `.clear()` events for audio and image diff --git a/js/audio/interactive/InteractiveAudio.svelte b/js/audio/interactive/InteractiveAudio.svelte index cf53e20382..791b000e39 100644 --- a/js/audio/interactive/InteractiveAudio.svelte +++ b/js/audio/interactive/InteractiveAudio.svelte @@ -44,6 +44,7 @@ start_recording: never; stop_recording: never; upload: never; + clear: never; }>; let old_value: null | FileData | string = null; @@ -97,6 +98,7 @@ on:start_recording={() => gradio.dispatch("start_recording")} on:stop_recording={() => gradio.dispatch("stop_recording")} on:upload={() => gradio.dispatch("upload")} + on:clear={() => gradio.dispatch("clear")} on:error={({ detail }) => { loading_status = loading_status || {}; loading_status.status = "error"; diff --git a/js/image/interactive/Image.svelte b/js/image/interactive/Image.svelte index 72e35ea8e8..d7d85d171d 100644 --- a/js/image/interactive/Image.svelte +++ b/js/image/interactive/Image.svelte @@ -113,6 +113,7 @@ } async function handle_sketch_clear(): Promise { + dispatch("clear"); sketch.clear(); await tick(); value = null;