Update assets tree as app._compile step.
If the assets change between hot reload, then update them before reloading (in case a CSS file was added or something).
This commit is contained in:
parent
a944a34e63
commit
8e3962426e
@ -99,7 +99,15 @@ from reflex.state import (
|
|||||||
_substate_key,
|
_substate_key,
|
||||||
code_uses_state_contexts,
|
code_uses_state_contexts,
|
||||||
)
|
)
|
||||||
from reflex.utils import codespaces, console, exceptions, format, prerequisites, types
|
from reflex.utils import (
|
||||||
|
codespaces,
|
||||||
|
console,
|
||||||
|
exceptions,
|
||||||
|
format,
|
||||||
|
path_ops,
|
||||||
|
prerequisites,
|
||||||
|
types,
|
||||||
|
)
|
||||||
from reflex.utils.exec import is_prod_mode, is_testing_env
|
from reflex.utils.exec import is_prod_mode, is_testing_env
|
||||||
from reflex.utils.imports import ImportVar
|
from reflex.utils.imports import ImportVar
|
||||||
|
|
||||||
@ -1008,7 +1016,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# try to be somewhat accurate - but still not 100%
|
# try to be somewhat accurate - but still not 100%
|
||||||
adhoc_steps_without_executor = 7
|
adhoc_steps_without_executor = 8
|
||||||
fixed_pages_within_executor = 5
|
fixed_pages_within_executor = 5
|
||||||
progress.start()
|
progress.start()
|
||||||
task = progress.add_task(
|
task = progress.add_task(
|
||||||
@ -1086,6 +1094,14 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
|
|
||||||
progress.advance(task)
|
progress.advance(task)
|
||||||
|
|
||||||
|
# Copy the assets.
|
||||||
|
with console.timing("Copy assets"):
|
||||||
|
path_ops.update_directory_tree(
|
||||||
|
src=Path.cwd() / constants.Dirs.APP_ASSETS,
|
||||||
|
dest=Path.cwd() / prerequisites.get_web_dir() / constants.Dirs.PUBLIC,
|
||||||
|
)
|
||||||
|
progress.advance(task)
|
||||||
|
|
||||||
# Use a forking process pool, if possible. Much faster, especially for large sites.
|
# Use a forking process pool, if possible. Much faster, especially for large sites.
|
||||||
# Fallback to ThreadPoolExecutor as something that will always work.
|
# Fallback to ThreadPoolExecutor as something that will always work.
|
||||||
executor = None
|
executor = None
|
||||||
|
Loading…
Reference in New Issue
Block a user