From 8dd6f4bc1901792f05cd59e86df7b1dbab692739 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 29 Jan 2024 16:51:22 -0800 Subject: [PATCH] Handle the case where examples is `null` for all components (#7192) * handle null examples * add changeset * add changeset * lint * merge conflict * fixes * add changeset * stories * feedback * examples --------- Co-authored-by: gradio-pr-bot --- .changeset/warm-jokes-fetch.md | 23 ++ js/audio/AudioExample.stories.svelte | 24 ++ js/audio/Example.svelte | 4 +- js/checkbox/Example.svelte | 4 +- js/code/Example.svelte | 4 +- .../ColorPickerExample.stories.svelte | 24 ++ js/colorpicker/Example.svelte | 4 +- js/dataset/Index.svelte | 46 +-- js/dropdown/Example.svelte | 4 +- js/file/Example.svelte | 4 +- js/fileexplorer/Example.svelte | 16 +- js/image/Example.svelte | 9 +- js/image/ImageExample.stories.svelte | 29 ++ js/image/shared/Image.svelte | 6 + js/markdown/Example.svelte | 4 +- js/model3D/Example.svelte | 4 +- js/number/Example.svelte | 4 +- js/radio/Example.svelte | 12 +- js/simpledropdown/Example.svelte | 4 +- js/simpleimage/Example.svelte | 21 +- js/simpletextbox/Example.svelte | 4 +- js/textbox/Example.svelte | 4 +- js/textbox/TextboxExample.stories.svelte | 24 ++ js/video/Example.svelte | 40 +-- pnpm-lock.yaml | 263 ++++++++++-------- 25 files changed, 380 insertions(+), 205 deletions(-) create mode 100644 .changeset/warm-jokes-fetch.md create mode 100644 js/audio/AudioExample.stories.svelte create mode 100644 js/colorpicker/ColorPickerExample.stories.svelte create mode 100644 js/image/ImageExample.stories.svelte create mode 100644 js/textbox/TextboxExample.stories.svelte diff --git a/.changeset/warm-jokes-fetch.md b/.changeset/warm-jokes-fetch.md new file mode 100644 index 0000000000000..53577b67d97a3 --- /dev/null +++ b/.changeset/warm-jokes-fetch.md @@ -0,0 +1,23 @@ +--- +"@gradio/audio": patch +"@gradio/checkbox": patch +"@gradio/code": patch +"@gradio/colorpicker": patch +"@gradio/dataset": patch +"@gradio/dropdown": patch +"@gradio/file": patch +"@gradio/fileexplorer": patch +"@gradio/image": patch +"@gradio/markdown": patch +"@gradio/model3d": patch +"@gradio/number": patch +"@gradio/radio": patch +"@gradio/simpledropdown": patch +"@gradio/simpleimage": patch +"@gradio/simpletextbox": patch +"@gradio/textbox": patch +"@gradio/video": patch +"gradio": patch +--- + +fix:Handle the case where examples is `null` for all components diff --git a/js/audio/AudioExample.stories.svelte b/js/audio/AudioExample.stories.svelte new file mode 100644 index 0000000000000..03be9fab22bd8 --- /dev/null +++ b/js/audio/AudioExample.stories.svelte @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/js/audio/Example.svelte b/js/audio/Example.svelte index 6b6a4a08c938f..1ebb90d67dd34 100644 --- a/js/audio/Example.svelte +++ b/js/audio/Example.svelte @@ -1,5 +1,5 @@ @@ -9,7 +9,7 @@ class:gallery={type === "gallery"} class:selected > - {value} + {value ? value : ""} diff --git a/js/markdown/Example.svelte b/js/markdown/Example.svelte index fa8f1b800ea77..40f17abb052be 100644 --- a/js/markdown/Example.svelte +++ b/js/markdown/Example.svelte @@ -1,7 +1,7 @@ @@ -9,7 +9,7 @@ class:gallery={type === "gallery"} class:selected > - {value} + {value ? value : ""} diff --git a/js/simpletextbox/Example.svelte b/js/simpletextbox/Example.svelte index 1fdf7500fa285..e8e8130c2987f 100644 --- a/js/simpletextbox/Example.svelte +++ b/js/simpletextbox/Example.svelte @@ -1,7 +1,7 @@ + + + + + + + + diff --git a/js/video/Example.svelte b/js/video/Example.svelte index 34ac786787c49..305f343988f6f 100644 --- a/js/video/Example.svelte +++ b/js/video/Example.svelte @@ -20,25 +20,27 @@ } -{#if playable()} -
-
-{:else} -
{value}
+{#if value} + {#if playable()} +
+
+ {:else} +
{value}
+ {/if} {/if}