Skip to content

Blocks.launch(js=...) is carried in the config but never executed in Gradio 6 (silent no-op; demo.load(js=...) works) #13636

Description

@timebeing92

Describe the bug

Blocks.launch(js=...) accepts a JavaScript function string and serializes it into the app config (GET /config returns it under the js key), but the 6.x frontend never evaluates it — the function silently does not run.

The same function string passed to demo.load(js=...) executes normally, so the string itself is valid; only the launch(js=...) channel is dead. Since the parameter is still accepted and documented, apps migrating from Gradio 4/5 lose their page-setup scripts silently — no error, no warning.

Expected: either the config js is executed on page load (as in Gradio 4/5), or launch(js=...)/Blocks(js=...) raises a deprecation error pointing at a working channel.

Have you searched existing issues? 🔎

Reproduction

import gradio as gr

with gr.Blocks() as demo:
    gr.Markdown("launch(js=) repro")

demo.launch(js="() => { document.title = 'LAUNCH-JS-RAN'; }")
  1. curl http://127.0.0.1:7860/config | jq .js"() => { document.title = 'LAUNCH-JS-RAN'; }" — the config carries the function.

  2. Open the app; wait for full load. document.title remains "Gradio". The function never runs (verified with Playwright; no console errors).

  3. Control: change the last line to

    demo.load(None, None, None, js="() => { document.title = 'LAUNCH-JS-RAN'; }")
    demo.launch()

    and the title changes — the identical string executes via the load event.

Screenshot

Not applicable.

Logs

No console errors — the config value is simply never evaluated.

System Info

Gradio version: 6.20.0
gradio_client version: 2.5.0
Python: 3.12.7
OS: macOS 26.3.1 (arm64)
Browser: Chromium (Playwright) and Chrome

Severity

I can work around it (moved the script to demo.load(js=...)), but the silent failure cost real debugging time and will bite anyone migrating 4/5-era apps.
\n\n## Before / after Spaces\n\n- Before fix\n- After fixdraft PR #13642

Before / after Spaces

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions