-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix Deep Link Issue #11202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Deep Link Issue #11202
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/e83259f631b7ad55f7c93c61eb62ebdb787b2521/gradio-5.29.1-py3-none-any.whlInstall Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@e83259f631b7ad55f7c93c61eb62ebdb787b2521#subdirectory=client/python"Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/e83259f631b7ad55f7c93c61eb62ebdb787b2521/gradio-client-1.14.2.tgzUse Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/e83259f631b7ad55f7c93c61eb62ebdb787b2521/dist/lite.js""></script> |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
|
Nice @freddyaboulton taking a look through this now. Is it possible to add a unit test for this btw? |
|
Thanks @freddyaboulton it looks like this fixes the original issue, but this does not seem to work for functions that return an updated component. Repro: So this works: import gradio as gr
with gr.Blocks() as demo:
text = gr.Textbox()
out = gr.Textbox()
gr.DeepLinkButton()
text.submit(fn=lambda x: x, inputs=text, outputs=out)
demo.launch()But this does not: import gradio as gr
with gr.Blocks() as demo:
text = gr.Textbox()
out = gr.Textbox()
gr.DeepLinkButton()
text.submit(fn=lambda x: gr.Textbox(x, lines=int(x)), inputs=text, outputs=out)
demo.launch()Screen.Recording.2025-05-15.at.11.12.35.AM.movYou'll notice that the output is not restored, neither the value nor the number of lines |
|
Thanks for catching that @abidlabs ! I fixed the issue and added a unit test as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works beautifully!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fix! LGTM!
|
Thank you for the reviews! |
Description
Closes: #11201
The Stateholder stored a shallow copy of the original blocks so updating one session's state could update the others.
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Testing and Formatting Your Code
PRs will only be merged if tests pass on CI. We recommend at least running the backend tests locally, please set up your Gradio environment locally and run the backed tests:
bash scripts/run_backend_tests.shPlease run these bash scripts to automatically format your code:
bash scripts/format_backend.sh, and (if you made any changes to non-Python files)bash scripts/format_frontend.sh