client_state: create Var from value when pushing from backend (#4474)

This ensures that the value is properly escaped/formatted for direct use in
javascript code.
This commit is contained in:
Masen Furer 2024-12-11 17:15:17 -08:00 committed by GitHub
parent d75a708e6b
commit 95eb663347
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -242,4 +242,5 @@ class ClientStateVar(Var):
"""
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})")