Skip to content
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

when leave current page, the event .then() or .success() not execute #10538

Open
1 task done
xiaozi0513 opened this issue Feb 7, 2025 · 3 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@xiaozi0513
Copy link

Describe the bug

When I launch the Gradio app, I click a button on the page, and then leave the page. I notice that only the test1 method is executed in the console, and the methods following .then() do not execute. They will only continue to execute once I return to the page.
i want know if any setting can change this behavior, when i leave current page, .then() method can continue execute. thanks

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import time

import gradio as gr


def test1():
    print("test1")
    time.sleep(10)
    print("test1 end")


def test2():
    print("test2")
    time.sleep(10)
    print("test2 end")


def test3():
    print("test3")
    time.sleep(10)
    print("test3 end")


with gr.Blocks() as demo:
    btn = gr.Button("点击")
    btn.click(test1).then(test2).then(test3)

demo.launch(server_name="0.0.0.0", server_port=8100)

Screenshot

No response

Logs

System Info

gradio 5.8.0

Severity

I can work around it

@xiaozi0513 xiaozi0513 added the bug Something isn't working label Feb 7, 2025
@freddyaboulton
Copy link
Collaborator

Yea if the page is closed there's no way we can send the request to the backend to run your function

@xiaozi0513
Copy link
Author

Yea if the page is closed there's no way we can send the request to the backend to run your function

not close the page, just switch to other page tab

@freddyaboulton
Copy link
Collaborator

Ah I see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants