basic functionality

This commit is contained in:
Khaleel Al-Adhami 2024-08-20 13:08:05 -07:00
parent d939bade33
commit e3ae1aa2b1
2 changed files with 28 additions and 1 deletions

View File

@ -552,6 +552,31 @@ class App(MiddlewareMixin, LifespanMixin, Base):
meta=meta, meta=meta,
) )
def _compile_page(self, route: str):
"""Compile a page.
Args:
route: The route of the page to compile.
"""
uncompiled_page = self.uncompiled_pages[route]
on_load = uncompiled_page.on_load
if on_load:
self.load_events[route] = (
on_load if isinstance(on_load, list) else [on_load]
)
self.uncompiled_pages[route] = UncompiledPage(
component=component,
route=route,
title=title,
description=description,
image=image,
on_load=on_load,
meta=meta,
)
def _compile_page(self, route: str): def _compile_page(self, route: str):
"""Compile a page. """Compile a page.

View File

@ -267,7 +267,9 @@ class Style(dict):
_var = LiteralVar.create(value) _var = LiteralVar.create(value)
if _var is not None: if _var is not None:
# Carry the imports/hooks when setting a Var as a value. # Carry the imports/hooks when setting a Var as a value.
self._var_data = VarData.merge(self._var_data, _var._get_all_var_data()) self._var_data = VarData.merge(
self._var_data if hasattr(self, "_var_data") else None, _var._get_all_var_data
())
super().__setitem__(key, value) super().__setitem__(key, value)