Describe the bug
Manipulating any Pydantic model type from a state raise a library error pydantic_core._pydantic_core.PydanticSerializationError: ... 'ImmutableMutableProxy' object cannot be converted to 'PyDict'.
To reproduce
- Define two Pydantic v2 models,
A and B, B a child if the first
- Assign
B to the app state as b: B = B()
- Execute
TypeAdapter(A).dump_json(self.b)
- See the error
Expected behavior
Any manipulation of a Pydantic model inside the state work like it should out of the state.
Context
- Python version: v3.13
- Reflex version: v0.7.0
- Pydantic version: v2.10.6
- OS: Debian Bookworm
- Browser (Optional): n/a
Describe the bug
Manipulating any Pydantic model type from a state raise a library error
pydantic_core._pydantic_core.PydanticSerializationError: ... 'ImmutableMutableProxy' object cannot be converted to 'PyDict'.To reproduce
AandB,Ba child if the firstBto the app state asb: B = B()TypeAdapter(A).dump_json(self.b)Expected behavior
Any manipulation of a Pydantic model inside the state work like it should out of the state.
Context