Repository navigation
Commit 429faeb
Ensure every component dispatches a
* Add change event to AnnotatedImage and native plots
Issue #5309 asks that every value-bearing component dispatch a `change`
event. AnnotatedImage and the native plots (BarPlot/LinePlot/ScatterPlot)
were missing `.change()`.
- AnnotatedImage: add Events.change to EVENTS. The frontend already
dispatches change via gradio.watch_for_change() and declares it in its
event types, so only the Python listener was missing.
- NativePlot: add Events.change to EVENTS, call gradio.watch_for_change()
in nativeplot/Index.svelte, and add `change` to NativePlotEvents.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* add changeset
* Add change event to remaining value components (buttons, Dataset, Timer, WorkflowCanvas)
Every component has a programmatically-settable `value` (a Button's value is
its label), so per #5309 every component should dispatch `change` when that
value changes. This completes the audit: no component is left without `change`.
- Button (and ClearButton/DuplicateButton/LoginButton/DeepLinkButton, which
render via the button frontend), DownloadButton, UploadButton, Dataset,
Timer, WorkflowCanvas: add Events.change to EVENTS.
- Wire gradio.watch_for_change() in the corresponding Index.svelte files and
declare `change` in their event type interfaces.
watch_for_change() only dispatches when props.value actually differs, so it is
added only to components that did not already manually dispatch change (no
double-firing for the ~30 components that handle change themselves).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Update changeset for full change-event coverage
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Add test that every component has a working .change() event
- test/test_components.py: test_all_components_have_change_event iterates all
core Component subclasses, asserts each has a `change` event and that wiring
`.change()` inside a Blocks context does not error.
- Fallback also gets Events.change + watch_for_change() so the invariant holds
for every component (its event types already declared `change`).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Fix UploadButton double change-firing, simplify test, regen skill docs
- UploadButton already dispatches `change` on upload, so the added
watch_for_change() made the change event fire twice (broke the js-test
"upload and change events fire after file upload"). Remove it.
- test_all_components_have_change_event: use the io_components fixture and a
single `component().change(lambda: None)` check (addresses review feedback).
- Regenerate references/event-listeners.md via scripts/generate_skill.py to
reflect the new change events (fixes hygiene-test).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Update js/button/Index.svelte
Co-authored-by: hysts <[email protected]>
* changes
---------
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: hysts <[email protected]>change event (#13502)1 parent a9550d8 commit 429faeb
23 files changed
Lines changed: 67 additions & 22 deletions
File tree
- .agents/skills/gradio/references
- .changeset
- gradio/components
- js
- button
- dataset
- downloadbutton
- fallback
- nativeplot
- timer
- workflowcanvas
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
0 commit comments