[codex] fix component load event target#13360
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://huggingface.co/buckets/gradio/pypi-previews/resolve/daba09a8ccec17bcbd0f4682e925dcba6a5f685d/gradio-6.14.0-py3-none-any.whlInstall Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@daba09a8ccec17bcbd0f4682e925dcba6a5f685d#subdirectory=client/python"Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/daba09a8ccec17bcbd0f4682e925dcba6a5f685d/gradio-client-2.2.0.tgz |
🦄 change detectedThis Pull Request includes changes to the following packages.
✅ Changeset approved by @freddyaboulton
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default mode and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit daba09a. Configure here.
| ] | ||
| assert len(load_dependencies) == 1 | ||
| assert load_dependencies[0]["targets"][0][1] == "load" | ||
| assert load_dependencies[0]["outputs"] == [button._id] |
There was a problem hiding this comment.
Regression test doesn't assert target ID is non-null
Medium Severity
The new regression test test_component_load_events_target_root is meant to verify that component load events target the root block (not None), but it never asserts that targets[0][0] is non-null or equals the root block's _id. The test only checks the event name (targets[0][1] == "load") and outputs. If the fix in blocks.py were reverted, this test would still pass because a (None, "load") target satisfies all three assertions. The key assertion — that the target component ID points to the root block — is missing.
Reviewed by Cursor Bugbot for commit daba09a. Configure here.



Summary
loadevent instead of serializing a null targetRoot cause
BlocksConfig.attach_load_events()was passingno_target=not has_targetfor component-attached startup load events, producingtargets=[(None, "load")]. The null-target load dependency can freeze the frontend renderer in Gradio 6.x for apps with a nonempty Dataframe and empty Row/Column layout;demo.loaduses(0, "load")and does not freeze.Fixes #13359
Validation
sfw uv run --with pytest --with pytest-asyncio python -m pytest test/test_blocks.py::TestComponentsInBlocks::test_component_load_events_target_root test/test_blocks.py::TestComponentsInBlocks::test_slider_random_value_config test/test_blocks.py::TestComponentsInBlocks::test_io_components_attach_load_events_when_value_is_fn test/test_blocks.py::TestComponentsInBlocks::test_get_load_events -qgit diff --checkLOGIN_KIND=login /tmp/check_min_login_dataframe.sh 7998 1 false false false false true 0 false false true/tmp/check_gaia_variant.sh 7996Note
Medium Risk
Touches
BlocksConfig.attach_load_events()dependency target serialization, which can affect how startup load events fire and render in the frontend. Change is small and covered by a regression test, but it impacts core event wiring.Overview
Fixes component-attached startup load events to always serialize with an explicit root
loadtarget (avoidingtargets=[(None, "load")]), preventing frontend hangs in certain layouts.Adds a regression test asserting load dependencies target
loadcorrectly and tweaks the thread-close test timing/marks itflaky. Also includes a patch changeset entry for the fix.Reviewed by Cursor Bugbot for commit bcf05f4. Bugbot is set up for automated code reviews on this repo. Configure here.