reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
19.87k stars 1.15k forks source link

Recursive @var definitions cause the compiler to stall forever #3788

Open bertbarabas opened 2 months ago

bertbarabas commented 2 months ago

Describe the bug I accidently made a recursive @var function i.e. where all it does is call itself when I really wanted to return the str of the _ private version of the value. This caused reflex run compilation to pause at step 3 and never complete.

image

To Reproduce any trivial @var where all it does is return itself. Steps to reproduce the behavior:

@rx.var
def foo(self) -> str:
    return self.foo

Expected behavior A clear and concise description of what you expected to happen.

Raise a proper error that a vars cannot have itself as a dependency

Specifics (please complete the following information):

Lendemor commented 2 months ago

(I edited return foo to return self.foo in the code snippet)