fix interactivity of value-less components with no dependencies (#2459)

* fix interactivity of value-less components with no dependencies

* changelog

* changelog fix

* changelog fix

* changelog fix

* formatting
This commit is contained in:
pngwn 2022-10-14 17:12:42 +01:00 committed by GitHub
parent 5089053052
commit 78ab2c8e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 16 deletions

View File

@ -5,6 +5,12 @@
* Ensure that Gradio does not take control of the HTML page title when embedding a gradio app as a web component, this behaviour flipped by adding `control_page_title="true"` to the webcomponent. [@pngwn](https://github.com/pngwn) in [PR 2400](https://github.com/gradio-app/gradio/pull/2400) * Ensure that Gradio does not take control of the HTML page title when embedding a gradio app as a web component, this behaviour flipped by adding `control_page_title="true"` to the webcomponent. [@pngwn](https://github.com/pngwn) in [PR 2400](https://github.com/gradio-app/gradio/pull/2400)
* Decreased latency in iterative-output demos by making the iteration asynchronous [@freddyaboulton](https://github.com/freddyaboulton) in [PR 2409](https://github.com/gradio-app/gradio/pull/2409) * Decreased latency in iterative-output demos by making the iteration asynchronous [@freddyaboulton](https://github.com/freddyaboulton) in [PR 2409](https://github.com/gradio-app/gradio/pull/2409)
* Fixed queue getting stuck under very high load by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 2374](https://github.com/gradio-app/gradio/pull/2374) * Fixed queue getting stuck under very high load by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 2374](https://github.com/gradio-app/gradio/pull/2374)
* Ensure that components always behave as if `interactive=True` were set when the following conditions are true:
- no default value is provided,
- they are not set as the input or output of an event,
- `interactive` kwarg is not set.
[@pngwn](https://github.com/pngwn) in [PR 2459](https://github.com/gradio-app/gradio/pull/2459)
## New Features: ## New Features:

13
demo/blocks_static/run.py Normal file
View File

@ -0,0 +1,13 @@
import gradio as gr
demo = gr.Blocks()
with demo:
gr.Image(
"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80"
)
gr.Textbox("hi")
gr.Number(3)
if __name__ == "__main__":
demo.launch()

View File

@ -1,10 +0,0 @@
import gradio as gr
demo = gr.Blocks()
with demo:
gr.Textbox("Hello")
gr.Number(5)
if __name__ == "__main__":
demo.launch()

View File

@ -100,12 +100,7 @@
const is_input = is_dep(id, "inputs", dependencies); const is_input = is_dep(id, "inputs", dependencies);
const is_output = is_dep(id, "outputs", dependencies); const is_output = is_dep(id, "outputs", dependencies);
if ( if (!is_input && !is_output && has_no_default_value(props?.value))
!is_input &&
!is_output &&
"value" in props &&
has_no_default_value(props?.value)
)
acc.add(id); // default dynamic acc.add(id); // default dynamic
if (is_input) acc.add(id); if (is_input) acc.add(id);