Repository navigation
Fix ReflexEvent argument order for client_handler_name in format_event - #7156
Conversation
…t_event format_event() appended client_handler_name as the third positional argument of ReflexEvent, but the JS constructor takes event_actions third and handler fourth. The handler string landed in event_actions and e.handler stayed null, so applyRestEvent routing (uploadFiles) never fired for events formatted through format_queue_events, e.g. an upload handler used as a call_script/call_function callback or toast action. Emit event_actions (JSON) third and client_handler_name fourth, matching LiteralEventVar.create.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
format_event()inreflex_base/utils/format.pyappendedclient_handler_nameas the third positional argument ofReflexEvent(...), but the JS constructor in.templates/web/utils/state.jsisReflexEvent(name, payload, event_actions, handler)—event_actionsis third andhandleris fourth.As a result, for any
EventSpecwith a non-emptyclient_handler_nameformatted throughformat_event, the handler string landed in theevent_actionsslot ande.handlerstayednull, so theevent.handler === "uploadFiles"routing inapplyRestEventcould never fire.Real-world impact
client_handler_nameis set to"uploadFiles"byrx.upload_files/rx.upload_files_chunkspecs. Such a spec flows throughformat_queue_events→format_eventwhen used as:rx.call_script/rx.call_functioncallbackaction/cancelbuttonon_click(oron_dismiss/on_auto_close)In those contexts the upload would silently never start.
Fix
Emit
event_actions(as JSON) third andclient_handler_namefourth, matching the already-correct pattern inLiteralEventVar.create. Output for specs without aclient_handler_nameis byte-identical to before, so no other compiled output changes.Test
Regression test
test_format_event_client_handler_nameintests/units/test_event.py— fails before the fix (handler string in the third slot), passes after.