Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rx Vars can return empty state, framework fails to force page reload #4748

Open
scottpersinger opened this issue Feb 4, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@scottpersinger
Copy link

Describe the bug
There is logic to detect if a state has expired from Redis when handling an event, and to force a page reload in that case:

await asyncio.create_task(

However this logic is not triggered simply from rendering an @rx.var like this:

    @rx.var
    def user_can_edit_agent(self) -> bool:
        return self.editable

So it can happen that the state which defines editable has expired, been recreated blank, and the frontend has re-rendered that rx.var but now it is showing blank data (in this case the "edit" panel disappears).

Various frontend events like clicking a tab can force the rx.var re-render (that is the case for our app).

To Reproduce
Render an rx.var inside a tabbed component. Now expire the Redis state backing the Var and then change the tab view so that Var value is re-rendered. Now it will show the initial state.

Expected behavior
It seems like forcing the page reload is the only "fix" for the expired state. Ultimately it seems like the framework should force reload pages before their states expire if the tab is still open. Or that could be an electable behavior.

Copy link

linear bot commented Feb 4, 2025

@Lendemor Lendemor added the bug Something isn't working label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants