Skip to content

Commit 976dcee

Browse files
committed
make sure the progress count is correct (#5327)
1 parent ad3cffc commit 976dcee

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

reflex/app.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,14 +1235,16 @@ def get_compilation_time() -> str:
12351235

12361236
# try to be somewhat accurate - but still not 100%
12371237
adhoc_steps_without_executor = 7
1238-
fixed_pages_within_executor = 5
1238+
fixed_pages_within_executor = 4
1239+
plugin_count = len(config.plugins)
12391240
progress.start()
12401241
task = progress.add_task(
12411242
f"[{get_compilation_time()}] Compiling:",
12421243
total=len(self._pages)
12431244
+ (len(self._unevaluated_pages) * 2)
12441245
+ fixed_pages_within_executor
1245-
+ adhoc_steps_without_executor,
1246+
+ adhoc_steps_without_executor
1247+
+ plugin_count,
12461248
)
12471249

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

1417+
def _submit_work_without_advancing(
1418+
fn: Callable[P, list[tuple[str, str]] | tuple[str, str] | None],
1419+
*args: P.args,
1420+
**kwargs: P.kwargs,
1421+
):
1422+
f = executor.submit(fn, *args, **kwargs)
1423+
result_futures.append(f)
1424+
14151425
for plugin in config.plugins:
14161426
plugin.pre_compile(
1417-
add_save_task=_submit_work,
1427+
add_save_task=_submit_work_without_advancing,
14181428
add_modify_task=(
14191429
lambda *args, plugin=plugin: modify_files_tasks.append(
14201430
(
@@ -1433,6 +1443,8 @@ def _submit_work(
14331443
else:
14341444
compile_results.append(result)
14351445

1446+
progress.advance(task, advance=len(config.plugins))
1447+
14361448
app_root = self._app_root(app_wrappers=app_wrappers)
14371449

14381450
# Get imports from AppWrap components.

0 commit comments

Comments
 (0)