ENG-8049: pass correct parameters to queueEvents#5962
Merged
Conversation
There was also another place in the call_script callback path where the incorrect parameters have been passed since at least 0.8 🙀
CodSpeed Performance ReportMerging #5962 will not alter performanceComparing Summary
|
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR fixes parameter passing issues to queueEvents and processEvent that have existed since the Remix migration (v0.8). The functions' signatures were updated to require 5 and 3 parameters respectively, but several call sites were still using the old signatures.
Changes made:
- state.js: Added missing
prependparameter (value:false) toqueueEventscall inqueueEventIfSocketExistsfunction - state.js: Replaced direct
queueEventscalls withqueueEventIfSocketExistsfor_clear_session_storageand_remove_session_storageevents to ensure proper null checking - format.py: Updated
format_queue_eventsto generate JavaScript code that passes all required parameters (prepend,navigate,params) when callingqueueEventsandprocessEvent
The fix ensures that callback functions generated by rx.call_script now correctly queue events with all required parameters.
Confidence Score: 5/5
- This PR is safe to merge - it fixes critical bugs in parameter passing that could cause runtime errors
- The changes are straightforward bug fixes that correct parameter mismatches between function signatures and call sites. All modifications follow existing patterns in the codebase, and the fix addresses issues that have existed since v0.8. No logic changes were made beyond adding the missing parameters.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| reflex/.templates/web/utils/state.js | 5/5 | Fixed parameter passing to queueEvents by adding missing prepend parameter and replaced direct queueEvents calls with queueEventIfSocketExists for session storage events |
| reflex/utils/format.py | 5/5 | Updated format_queue_events to pass all required parameters (prepend, navigate, params) to queueEvents and processEvent functions in generated JavaScript code |
Sequence Diagram
sequenceDiagram
participant Script as rx.call_script
participant Format as format_queue_events
participant JS as Generated JS
participant Queue as queueEvents
participant Process as processEvent
participant Socket as WebSocket
Note over Script,Format: Python Side (Backend)
Script->>Format: format_queue_events(events)
Format->>JS: Generate callback function
Note over JS: OLD: queueEvents([...], socket)<br/>NEW: queueEvents([...], socket, false, navigate, params)
Note over JS,Socket: JavaScript Side (Frontend)
JS->>Queue: Call with 5 parameters
Note over Queue: events, socket, prepend, navigate, params
Queue->>Process: processEvent(socket, navigate, params)
Process->>Socket: emit("event", event)
Note over Script,Socket: Session Storage Events
alt _clear_session_storage or _remove_session_storage
JS->>Queue: OLD: queueEvents(initialEvents(), socket, navigate, params)
Note over Queue: Missing prepend parameter!
JS->>Queue: NEW: queueEventIfSocketExists(initialEvents(), socket, navigate, params)
Queue->>Queue: Adds false for prepend internally
end
2 files reviewed, no comments
adhami3310
approved these changes
Nov 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was also another place in the call_script callback path where the incorrect parameters have been passed since at least 0.8 🙀