Skip to content

improve hybrid property - #6812

Draft
benedikt-bartscher wants to merge 3 commits into
reflex-dev:mainfrom
benedikt-bartscher:improve-hybrid-property
Draft

improve hybrid property#6812
benedikt-bartscher wants to merge 3 commits into
reflex-dev:mainfrom
benedikt-bartscher:improve-hybrid-property

Conversation

@benedikt-bartscher

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR redesigns hybrid properties as standalone descriptors and improves their frontend typing and class-construction behavior.

  • Preserves getter, setter, deleter, and var-function bindings through a unified descriptor-copy path.
  • Supports aliased and classmethod var functions, optional frontend values, and typed class-level access.
  • Avoids evaluating hybrid-property descriptors while state classes are still under construction.
  • Extends dependency tracking, property introspection, and object-var access for the new descriptor implementation.
  • Adds regression coverage for binding, inheritance, class access, setter/deleter chaining, and absent frontend values.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported decorator binding-copy defect is fixed: every accessor decorator now derives a compatible binding object, and rebinding preserves the getter, setter, deleter, var function, documentation, and target property name.

Important Files Changed

Filename Overview
packages/reflex-base/src/reflex_base/vars/hybrid_property.py Reimplements HybridProperty without inheriting from property and fixes decorator copying through a binding descriptor that preserves all accessor state.
reflex/state.py Avoids descriptor evaluation during state-class method inspection by traversing class dictionaries directly.
packages/reflex-base/src/reflex_base/vars/dep_tracking.py Treats HybridProperty getters like ordinary property getters during dependency analysis.
packages/reflex-base/src/reflex_base/vars/object.py Handles hybrid properties that explicitly have no frontend value when accessed through ObjectVar.
tests/units/vars/test_hybrid_property.py Adds focused regression tests covering the prior binding-copy failure and the expanded descriptor behavior.

Reviews (3): Last reviewed commit: "wip" | Re-trigger Greptile

Comment thread packages/reflex-base/src/reflex_base/vars/hybrid_property.py Outdated
@codspeed-hq

codspeed-hq Bot commented Jul 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing benedikt-bartscher:improve-hybrid-property (e9d7ecb) with main (416eb34)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant