From 4601cca9970e5d257b7d00460308b864cca0320b Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Wed, 21 Feb 2024 05:41:27 -0800 Subject: [PATCH] Revert "Added descriptor for backend vars (#2618)" (#2682) This reverts commit f9d219407fa30558bf4eba9d39664efc46eba0b9. --- reflex/state.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/reflex/state.py b/reflex/state.py index a42f85a64..50468c0b4 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -388,9 +388,6 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): cls._init_var_dependency_dicts() - for name in cls.new_backend_vars: - setattr(cls, name, PrivateVarDescriptor()) - @staticmethod def _copy_fn(fn: Callable) -> Callable: """Copy a function. Used to copy ComputedVars and EventHandlers from mixins. @@ -2435,20 +2432,3 @@ def code_uses_state_contexts(javascript_code: str) -> bool: True if the code attempts to access a member of StateContexts. """ return bool("useContext(StateContexts" in javascript_code) - - -class PrivateVarDescriptor: - """A descriptor to raise error in case private vars is accessed on thr frontend.""" - - def __get__(self, *args, **kwargs): - """Raise error on get value. - - - Args: - *args: The args to pass to the function. - **kwargs: The kwargs to pass to the function. - - Raises: - TypeError: if a background variable is used in frontend. - """ - raise TypeError("Backend Vars cannot be accessed on the frontend.")