Merge remote-tracking branch 'origin/main' into reflex-0.4.0
This commit is contained in:
commit
c9fadafc06
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "reflex"
|
name = "reflex"
|
||||||
version = "0.3.9"
|
version = "0.3.10"
|
||||||
description = "Web apps in pure Python."
|
description = "Web apps in pure Python."
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
authors = [
|
authors = [
|
||||||
|
@ -63,6 +63,10 @@ def _compile_theme(theme: dict) -> str:
|
|||||||
return templates.THEME.render(theme=theme)
|
return templates.THEME.render(theme=theme)
|
||||||
|
|
||||||
|
|
||||||
|
def _is_dev_mode() -> bool:
|
||||||
|
return os.environ.get("REFLEX_ENV_MODE", "dev") == "dev"
|
||||||
|
|
||||||
|
|
||||||
def _compile_contexts(state: Optional[Type[BaseState]]) -> str:
|
def _compile_contexts(state: Optional[Type[BaseState]]) -> str:
|
||||||
"""Compile the initial state and contexts.
|
"""Compile the initial state and contexts.
|
||||||
|
|
||||||
@ -72,16 +76,15 @@ def _compile_contexts(state: Optional[Type[BaseState]]) -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
The compiled context file.
|
The compiled context file.
|
||||||
"""
|
"""
|
||||||
is_dev_mode = os.environ.get("REFLEX_ENV_MODE", "dev") == "dev"
|
|
||||||
return (
|
return (
|
||||||
templates.CONTEXT.render(
|
templates.CONTEXT.render(
|
||||||
initial_state=utils.compile_state(state),
|
initial_state=utils.compile_state(state),
|
||||||
state_name=state.get_name(),
|
state_name=state.get_name(),
|
||||||
client_storage=utils.compile_client_storage(state),
|
client_storage=utils.compile_client_storage(state),
|
||||||
is_dev_mode=is_dev_mode,
|
is_dev_mode=_is_dev_mode(),
|
||||||
)
|
)
|
||||||
if state
|
if state
|
||||||
else templates.CONTEXT.render(is_dev_mode=is_dev_mode)
|
else templates.CONTEXT.render(is_dev_mode=_is_dev_mode())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -238,7 +241,12 @@ def _compile_stateful_components(
|
|||||||
|
|
||||||
# When the component is referenced by more than one page, render it
|
# When the component is referenced by more than one page, render it
|
||||||
# to be included in the STATEFUL_COMPONENTS module.
|
# to be included in the STATEFUL_COMPONENTS module.
|
||||||
if isinstance(component, StatefulComponent) and component.references > 1:
|
# Skip this step in dev mode, thereby avoiding potential hot reload errors for larger apps
|
||||||
|
if (
|
||||||
|
isinstance(component, StatefulComponent)
|
||||||
|
and component.references > 1
|
||||||
|
and not _is_dev_mode()
|
||||||
|
):
|
||||||
# Reset this flag to render the actual component.
|
# Reset this flag to render the actual component.
|
||||||
component.rendered_as_shared = False
|
component.rendered_as_shared = False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user