Skip to content

Commit cf778f1

Browse files
committed
[ENG-4776] Write stateful pages marker earlier when should_compile is False (#4868)
Fix issue where the presence of `.web/backend` without `.web/backend/stateful_pages.json` was breaking detection statefulness.
1 parent 2cb64ac commit cf778f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

reflex/app.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,9 @@ def get_compilation_time() -> str:
11031103
console.debug(f"Evaluating page: {route}")
11041104
self._compile_page(route, save_page=should_compile)
11051105

1106+
# Save the pages which created new states at eval time.
1107+
self._write_stateful_pages_marker()
1108+
11061109
# Add the optional endpoints (_upload)
11071110
self._add_optional_endpoints()
11081111

@@ -1145,6 +1148,8 @@ def get_compilation_time() -> str:
11451148
)[:10]
11461149
)
11471150
)
1151+
# Save the pages which created new states at eval time.
1152+
self._write_stateful_pages_marker()
11481153

11491154
# Add the optional endpoints (_upload)
11501155
self._add_optional_endpoints()
@@ -1366,7 +1371,8 @@ def _submit_work(fn: Callable[..., tuple[str, str]], *args, **kwargs):
13661371
for output_path, code in compile_results:
13671372
compiler_utils.write_page(output_path, code)
13681373

1369-
# Write list of routes that create dynamic states for backend to use.
1374+
def _write_stateful_pages_marker(self):
1375+
"""Write list of routes that create dynamic states for the backend to use later."""
13701376
if self._state is not None:
13711377
stateful_pages_marker = (
13721378
prerequisites.get_backend_dir() / constants.Dirs.STATEFUL_PAGES

0 commit comments

Comments
 (0)