Skip to content

Commit 3cb4443

Browse files
authored
add evaluate time to the progress counter (#4722)
1 parent 80a26b4 commit 3cb4443

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

reflex/app.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -958,20 +958,16 @@ def get_compilation_time() -> str:
958958

959959
should_compile = self._should_compile()
960960

961-
for route in self._unevaluated_pages:
962-
console.debug(f"Evaluating page: {route}")
963-
self._compile_page(route, save_page=should_compile)
961+
if not should_compile:
962+
for route in self._unevaluated_pages:
963+
console.debug(f"Evaluating page: {route}")
964+
self._compile_page(route, save_page=should_compile)
964965

965-
# Add the optional endpoints (_upload)
966-
self._add_optional_endpoints()
966+
# Add the optional endpoints (_upload)
967+
self._add_optional_endpoints()
967968

968-
if not should_compile:
969969
return
970970

971-
self._validate_var_dependencies()
972-
self._setup_overlay_component()
973-
self._setup_error_boundary()
974-
975971
# Create a progress bar.
976972
progress = Progress(
977973
*Progress.get_default_columns()[:-1],
@@ -980,16 +976,31 @@ def get_compilation_time() -> str:
980976
)
981977

982978
# try to be somewhat accurate - but still not 100%
983-
adhoc_steps_without_executor = 6
979+
adhoc_steps_without_executor = 7
984980
fixed_pages_within_executor = 5
985981
progress.start()
986982
task = progress.add_task(
987983
f"[{get_compilation_time()}] Compiling:",
988984
total=len(self._pages)
985+
+ (len(self._unevaluated_pages) * 2)
989986
+ fixed_pages_within_executor
990987
+ adhoc_steps_without_executor,
991988
)
992989

990+
for route in self._unevaluated_pages:
991+
console.debug(f"Evaluating page: {route}")
992+
self._compile_page(route, save_page=should_compile)
993+
progress.advance(task)
994+
995+
# Add the optional endpoints (_upload)
996+
self._add_optional_endpoints()
997+
998+
self._validate_var_dependencies()
999+
self._setup_overlay_component()
1000+
self._setup_error_boundary()
1001+
1002+
progress.advance(task)
1003+
9931004
# Get the env mode.
9941005
config = get_config()
9951006

0 commit comments

Comments
 (0)