Skip to content

Commit

Permalink
client_state: create Var from value when pushing from backend (#4474)
Browse files Browse the repository at this point in the history
This ensures that the value is properly escaped/formatted for direct use in
javascript code.
  • Loading branch information
masenf authored Dec 12, 2024
1 parent d75a708 commit 95eb663
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions reflex/experimental/client_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,5 @@ def push(self, value: Any) -> EventSpec:
"""
if not self._global_ref:
raise ValueError("ClientStateVar must be global to push the value.")
value = Var.create(value)
return run_script(f"{_client_state_ref(self._setter_name)}({value})")

0 comments on commit 95eb663

Please sign in to comment.