Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,14 +1235,16 @@ def get_compilation_time() -> str:

# try to be somewhat accurate - but still not 100%
adhoc_steps_without_executor = 7
fixed_pages_within_executor = 5
fixed_pages_within_executor = 4
plugin_count = len(config.plugins)
progress.start()
task = progress.add_task(
f"[{get_compilation_time()}] Compiling:",
total=len(self._pages)
+ (len(self._unevaluated_pages) * 2)
+ fixed_pages_within_executor
+ adhoc_steps_without_executor,
+ adhoc_steps_without_executor
+ plugin_count,
)

with console.timing("Evaluate Pages (Frontend)"):
Expand Down Expand Up @@ -1412,9 +1414,17 @@ def _submit_work(
# Compile the theme.
_submit_work(compile_theme, self.style)

def _submit_work_without_advancing(
fn: Callable[P, list[tuple[str, str]] | tuple[str, str] | None],
*args: P.args,
**kwargs: P.kwargs,
):
f = executor.submit(fn, *args, **kwargs)
result_futures.append(f)

for plugin in config.plugins:
plugin.pre_compile(
add_save_task=_submit_work,
add_save_task=_submit_work_without_advancing,
add_modify_task=(
lambda *args, plugin=plugin: modify_files_tasks.append(
(
Expand All @@ -1433,6 +1443,8 @@ def _submit_work(
else:
compile_results.append(result)

progress.advance(task, advance=len(config.plugins))

app_root = self._app_root(app_wrappers=app_wrappers)

# Get imports from AppWrap components.
Expand Down