fix: raise clear error for unserialized properties on dataclass and Pydantic vars
SO
14h ago+278+278+012345678901234567890123456789-16-16-01234567890123456789
All Submissions:
- Have you followed the guidelines stated in [CONTRIBUTING.md](https://github.com/reflex-dev/reflex/blob/main/CONTRIBUTING.md) file?
- Have you checked to ensure there aren't any other open [Pull Requests](https://github.com/reflex-dev/reflex/pulls) for the desired change?
Type of change
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change requires a documentation update
New Feature Submission:
- Does your submission pass the tests?
- Have you linted your code locally prior to submission?
Changes To Core Features:
- Have you added an explanation of what your changes do and why you'd like us to include them?
- Have you written new tests for your core changes, as applicable?
- Have you successfully ran tests with your changes locally?
Description
This change prevents plain Python properties on Pydantic models and dataclasses from being treated as accessible Reflex Vars when those properties are not included in the serialized output. Accessing such properties could generate a frontend reference to a value that does not exist in the serialized object, resulting in undefined at runtime.
The change provides a clear error for unsupported properties while preserving access to declared fields and Pydantic computed_field values. Regression tests cover both Pydantic models and dataclasses.
Closes #7633