|
@@ -558,11 +558,12 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
meta=meta,
|
|
meta=meta,
|
|
)
|
|
)
|
|
|
|
|
|
- def _compile_page(self, route: str):
|
|
|
|
|
|
+ def _compile_page(self, route: str, save_page: bool = True):
|
|
"""Compile a page.
|
|
"""Compile a page.
|
|
|
|
|
|
Args:
|
|
Args:
|
|
route: The route of the page to compile.
|
|
route: The route of the page to compile.
|
|
|
|
+ save_page: If True, the compiled page is saved to self.pages.
|
|
"""
|
|
"""
|
|
component, enable_state = compiler.compile_unevaluated_page(
|
|
component, enable_state = compiler.compile_unevaluated_page(
|
|
route, self.unevaluated_pages[route], self.state, self.style, self.theme
|
|
route, self.unevaluated_pages[route], self.state, self.style, self.theme
|
|
@@ -573,7 +574,8 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
|
|
|
# Add the page.
|
|
# Add the page.
|
|
self._check_routes_conflict(route)
|
|
self._check_routes_conflict(route)
|
|
- self.pages[route] = component
|
|
|
|
|
|
+ if save_page:
|
|
|
|
+ self.pages[route] = component
|
|
|
|
|
|
def get_load_events(self, route: str) -> list[IndividualEventType[[], Any]]:
|
|
def get_load_events(self, route: str) -> list[IndividualEventType[[], Any]]:
|
|
"""Get the load events for a route.
|
|
"""Get the load events for a route.
|
|
@@ -873,14 +875,16 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
# If a theme component was provided, wrap the app with it
|
|
# If a theme component was provided, wrap the app with it
|
|
app_wrappers[(20, "Theme")] = self.theme
|
|
app_wrappers[(20, "Theme")] = self.theme
|
|
|
|
|
|
|
|
+ should_compile = self._should_compile()
|
|
|
|
+
|
|
for route in self.unevaluated_pages:
|
|
for route in self.unevaluated_pages:
|
|
console.debug(f"Evaluating page: {route}")
|
|
console.debug(f"Evaluating page: {route}")
|
|
- self._compile_page(route)
|
|
|
|
|
|
+ self._compile_page(route, save_page=should_compile)
|
|
|
|
|
|
# Add the optional endpoints (_upload)
|
|
# Add the optional endpoints (_upload)
|
|
self._add_optional_endpoints()
|
|
self._add_optional_endpoints()
|
|
|
|
|
|
- if not self._should_compile():
|
|
|
|
|
|
+ if not should_compile:
|
|
return
|
|
return
|
|
|
|
|
|
self._validate_var_dependencies()
|
|
self._validate_var_dependencies()
|