def test_app_state_determination():
    """Test that the stateless status of an app is determined correctly."""
    a1 = App()
    assert a1._state is None

    # No state, no router, no event handlers.
    a1.add_page(rx.box("Index"), route="/")
    assert a1._state is None

    # Add a page with `on_load` enables state.
    a1.add_page(rx.box("About"), route="/about", on_load=rx.console_log(""))
    a1._compile_page("about")
    assert a1._state is not None

    a2 = App()
    assert a2._state is None

    # Referencing a state Var enables state.
    a2.add_page(rx.box(rx.text(GenState.value)), route="/")
    a2._compile_page("index")
    assert a2._state is not None

    a3 = App()
    assert a3._state is None

    # Referencing router enables state.
    a3.add_page(rx.box(rx.text(State.router.page.full_path)), route="/")
    a3._compile_page("index")
    assert a3._state is not None

    a4 = App()
    assert a4._state is None

    a4.add_page(rx.box(rx.button("Click", on_click=rx.console_log(""))), route="/")
    assert a4._state is None

    a4.add_page(
        rx.box(rx.button("Click", on_click=DynamicState.on_counter)), route="/page2"
    )
    a4._compile_page("page2")
    assert a4._state is not None
Test that the stateless status of an app is determined correctly.
tests/units/test_app.py