Skip to content

Commit faba1e4

Browse files
committed
Skip MutableProxy rebind self for _sa_instrumented functions
Not a general solution to the issue of cases where rebinding `self` might break descriptors, but at least fix the case for sqlalchemy models. Fix #6167
1 parent 3c11451 commit faba1e4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

reflex/istate/proxy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ def __getattr__(self, __name: str) -> Any:
572572
)
573573
and (func := getattr(value, "__func__", None)) is not None
574574
and not inspect.isclass(getattr(value, "__self__", None))
575+
# skip SQLAlchemy instrumented methods
576+
and not getattr(value, "_sa_instrumented", False)
575577
):
576578
# Rebind `self` to the proxy on methods to capture nested mutations.
577579
return functools.partial(func, self)

0 commit comments

Comments
 (0)