fix onload method not working in prod mode (#2049)

This commit is contained in:
Thomas Brandého 2023-10-27 17:43:02 +02:00 committed by GitHub
parent 804f55dbf2
commit edf9c32142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -614,6 +614,14 @@ class App(Base):
def compile(self):
"""Compile the app and output it to the pages folder."""
# add the pages before the compile check so App know onload methods
for render, kwargs in DECORATED_PAGES:
self.add_page(render, **kwargs)
# Render a default 404 page if the user didn't supply one
if constants.Page404.SLUG not in self.pages:
self.add_custom_404_page()
if not self._should_compile():
return
@ -624,13 +632,6 @@ class App(Base):
TimeElapsedColumn(),
)
for render, kwargs in DECORATED_PAGES:
self.add_page(render, **kwargs)
# Render a default 404 page if the user didn't supply one
if constants.Page404.SLUG not in self.pages:
self.add_custom_404_page()
task = progress.add_task("Compiling: ", total=len(self.pages))
# TODO: include all work done in progress indicator, not just self.pages