File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -2464,15 +2464,25 @@ class OnLoadInternalState(State):
24642464 """
24652465
24662466 # Cannot properly annotate this as `App` due to circular import issues.
2467- _app_ref : ClassVar = None
2467+ _app_ref : ClassVar [ Any ] = None
24682468
24692469 def on_load_internal (self ) -> list [Event | EventSpec | event .EventCallback ] | None :
24702470 """Queue on_load handlers for the current page.
24712471
24722472 Returns:
24732473 The list of events to queue for on load handling.
2474+
2475+ Raises:
2476+ TypeError: If the app reference is not of type App.
24742477 """
2478+ from reflex .app import App
2479+
24752480 app = type (self )._app_ref or prerequisites .get_and_validate_app ().app
2481+ if not isinstance (app , App ):
2482+ msg = (
2483+ f"Expected app to be of type { App .__name__ } , got { type (app ).__name__ } ."
2484+ )
2485+ raise TypeError (msg )
24762486 # Cache the app reference for subsequent calls.
24772487 if type (self )._app_ref is None :
24782488 type(self )._app_ref = app
You can’t perform that action at this time.
0 commit comments