Fix .clear() events for audio and image (#5587)

* clear

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Dawood Khan 2023-09-18 19:06:52 -04:00 committed by GitHub
parent 0be1e51f4f
commit e0d61b8baa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,7 @@
---
"@gradio/audio": patch
"@gradio/image": patch
"gradio": patch
---
fix:Fix `.clear()` events for audio and image

View File

@ -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";

View File

@ -113,6 +113,7 @@
}
async function handle_sketch_clear(): Promise<void> {
dispatch("clear");
sketch.clear();
await tick();
value = null;