Describe the bug
Var._replace documents _var_data as a replaceable field, but passing it raises because _replace already supplies _var_data (merged from the existing var) to dataclasses.replace() and the caller's keyword is passed a second time.
To Reproduce
import reflex as rx
from reflex.vars import VarData
v = rx.Var.create(5)
v._replace(_var_data=VarData(imports={}))
# TypeError: dataclasses.replace() got multiple values for keyword argument '_var_data'
rx.Var.create(5, _var_data=VarData(...)) works.
Expected behavior
_replace(_var_data=...) replaces (or merges) the var data, or the signature rejects the keyword with a message that points at merge_var_data / Var.create(..., _var_data=...).
Specifics
- Reflex 0.9.12a1 (reflex-base 0.9.12a1); pre-existing, identical on 0.9.11.post1
- Python 3.11.15
Additional context
0.9.12a1 pre-release QA, vars_typing cluster, observation O5 in vars_typing/NOTES.md. Related: #3531 tightened the accepted _replace kwargs.
Describe the bug
Var._replacedocuments_var_dataas a replaceable field, but passing it raises because_replacealready supplies_var_data(merged from the existing var) todataclasses.replace()and the caller's keyword is passed a second time.To Reproduce
rx.Var.create(5, _var_data=VarData(...))works.Expected behavior
_replace(_var_data=...)replaces (or merges) the var data, or the signature rejects the keyword with a message that points atmerge_var_data/Var.create(..., _var_data=...).Specifics
Additional context
0.9.12a1 pre-release QA,
vars_typingcluster, observation O5 invars_typing/NOTES.md. Related: #3531 tightened the accepted_replacekwargs.