Skip to content

Commit

Permalink
Merge branch 'main' into 3712-js-client
Browse files Browse the repository at this point in the history
  • Loading branch information
abidlabs committed May 11, 2023
2 parents 32662ff + fcf744a commit 229b270
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@ No changes to highlight.
## New Features:

- Adds a `root_path` parameter to `launch()` that allows running Gradio applications on subpaths (e.g. www.example.com/app) behind a proxy, by [@abidlabs](https://github.com/abidlabs) in [PR 4133](https://github.com/gradio-app/gradio/pull/4133)
- Fix dropdown change listener to trigger on change when updated as an output by [@aliabid94](https://github.com/aliabid94) in [PR 4128](https://github.com/gradio-app/gradio/pull/4128).

## Bug Fixes:

Expand Down
4 changes: 2 additions & 2 deletions client/python/test/test_client.py
Expand Up @@ -746,8 +746,8 @@ def test_file_io(self, file_io_demo):
"type": "List[str]",
"description": "List of filepath(s) or URL(s) to files",
}
# Will change to list when we do the next gradio release
assert isinstance(inputs[0]["example_input"], str)
assert isinstance(inputs[0]["example_input"], list)
assert isinstance(inputs[0]["example_input"][0], str)

assert inputs[1]["python_type"] == {
"type": "str",
Expand Down
23 changes: 8 additions & 15 deletions js/form/src/Dropdown.svelte
Expand Up @@ -7,6 +7,7 @@
export let label: string;
export let info: string | undefined = undefined;
export let value: string | Array<string> | undefined;
let old_value = Array.isArray(value) ? value.slice() : value;
export let multiselect: boolean = false;
export let max_choices: number;
export let choices: Array<string>;
Expand Down Expand Up @@ -46,7 +47,6 @@
value: option,
selected: true
});
dispatch("change", value);
}
value = value;
}
Expand All @@ -59,14 +59,12 @@
value: option,
selected: false
});
dispatch("change", value);
}
function remove_all(e: any) {
value = [];
inputValue = "";
e.preventDefault();
dispatch("change", value);
}
function handleOptionMousedown(e: any) {
Expand All @@ -92,7 +90,6 @@
value: option,
selected: true
});
dispatch("change", value);
return;
}
}
Expand All @@ -108,7 +105,6 @@
value: value,
selected: true
});
dispatch("change", value);
}
inputValue = activeOption;
showOptions = false;
Expand Down Expand Up @@ -148,6 +144,13 @@
}
}
}
$: {
if (JSON.stringify(value) != JSON.stringify(old_value)) {
dispatch("change", value);
old_value = Array.isArray(value) ? value.slice() : value;
}
}
</script>

<label>
Expand Down Expand Up @@ -190,14 +193,12 @@
on:keyup={() => {
if (allow_custom_value) {
value = inputValue;
dispatch("change", value);
}
}}
on:blur={() => {
if (multiselect) {
inputValue = "";
} else if (!allow_custom_value) {
let old_value = value;
if (value !== inputValue) {
if (typeof value === "string" && inputValue == "") {
inputValue = value;
Expand All @@ -206,9 +207,6 @@
inputValue = "";
}
}
if (old_value !== value) {
dispatch("change", value);
}
}
showOptions = false;
}}
Expand Down Expand Up @@ -294,11 +292,6 @@
height: 18px;
}
.single-select {
margin: var(--spacing-sm);
color: var(--body-text-color);
}
.secondary-wrap {
display: flex;
flex: 1 1 0%;
Expand Down

0 comments on commit 229b270

Please sign in to comment.