MCPcopy Create free account
hub / github.com/dot-agent/nextpy / State

Class State

nextpy/backend/state.py:1268–1293  ·  view source on GitHub ↗

The app Base State.

Source from the content-addressed store, hash-verified

1266
1267
1268class State(BaseState):
1269 """The app Base State."""
1270
1271 # The hydrated bool.
1272 is_hydrated: bool = False
1273
1274 def on_load_internal(self) -> list[Event | EventSpec] | None:
1275 """Queue on_load handlers for the current page.
1276
1277 Returns:
1278 The list of events to queue for on load handling.
1279 """
1280 # Do not app.compile_()! It should be already compiled by now.
1281 app = getattr(prerequisites.get_app(), constants.CompileVars.APP)
1282 load_events = app.get_load_events(self.router.page.path)
1283 if not load_events and self.is_hydrated:
1284 return # Fast path for page-to-page navigation
1285 self.is_hydrated = False
1286 return [
1287 *fix_events(
1288 load_events,
1289 self.router.session.client_token,
1290 router_data=self.router_data,
1291 ),
1292 type(self).set_is_hydrated(True), # type: ignore
1293 ]
1294
1295
1296class StateProxy(wrapt.ObjectProxy):

Callers 3

test_preprocessFunction · 0.90

Calls

no outgoing calls

Tested by 3

test_preprocessFunction · 0.72