reflex
reflex copied to clipboard
Page unload event feature request
I would like to make a feature request for a new hook for a page unload event on_unload
, analogous to on_load
Page Load Events
eg. It would be useful to know when to stop a rx.background job. My use case would be to know when the user has navigated away from the page.
eg.
import reflex as rx
class State(rx.State):
def on_load(self):
print("Page loaded")
def on_unload(self):
print("Page is being unloaded")
def index():
return rx.vstack(rx.text("hello world"))
app = rx.App()
app.add_page(index, on_load=State.on_load, on_unload=State.on_unload)
Some background info: https://discord.com/channels/1029853095527727165/1270975091676807179/1270975091676807179 https://discord.com/channels/1029853095527727165/1270899028678414428/1270899030934818897
π Thanks!