Hi there, I’ve been trying to get the on_load behaviour to work, and it only seems to work for the index page. Here’s how I’m doing it:
import reflex as rx
from rxconfig import config
class State(rx.State):
"""The app state."""
@rx.event
def do_something(self):
print('doing something')
class SecondState(rx.State):
"""The app state."""
@rx.event
def do_something(self):
print('doing something second state')
@rx.page(on_load=State.do_something)
def index() -> rx.Component:
return rx.container(
rx.text('Page'),
rx.link('go to a',href='/a/')
)
@rx.page(on_load=SecondState.do_something)
def page_a() -> rx.Component:
return rx.vstack(
rx.text('Page a'),
rx.link('go to index', href='/')
)
app = rx.App()
app.add_page(index)
app.add_page(page_a, route="/a/")
‘do_something’ only seems to trigger for the index page. Anyone know what I’m doing wrong?