fix order of operations and add note
This commit is contained in:
parent
d7768f8136
commit
241940efec
@ -900,6 +900,18 @@ class App(MiddlewareMixin, LifespanMixin, Base):
|
|||||||
all_imports = {}
|
all_imports = {}
|
||||||
custom_components = set()
|
custom_components = set()
|
||||||
|
|
||||||
|
# This has to happen before compiling stateful components as that
|
||||||
|
# prevents recursive functions from reaching all components.
|
||||||
|
for component in self.pages.values():
|
||||||
|
# Add component._get_all_imports() to all_imports.
|
||||||
|
all_imports.update(component._get_all_imports())
|
||||||
|
|
||||||
|
# Add the app wrappers from this component.
|
||||||
|
app_wrappers.update(component._get_all_app_wrap_components())
|
||||||
|
|
||||||
|
# Add the custom components from the page to the set.
|
||||||
|
custom_components |= component._get_all_custom_components()
|
||||||
|
|
||||||
# Perform auto-memoization of stateful components.
|
# Perform auto-memoization of stateful components.
|
||||||
(
|
(
|
||||||
stateful_components_path,
|
stateful_components_path,
|
||||||
@ -985,16 +997,6 @@ class App(MiddlewareMixin, LifespanMixin, Base):
|
|||||||
compile_results.append(future.result())
|
compile_results.append(future.result())
|
||||||
progress.advance(task)
|
progress.advance(task)
|
||||||
|
|
||||||
for component in self.pages.values():
|
|
||||||
# Add component._get_all_imports() to all_imports.
|
|
||||||
all_imports.update(component._get_all_imports())
|
|
||||||
|
|
||||||
# Add the app wrappers from this component.
|
|
||||||
app_wrappers.update(component._get_all_app_wrap_components())
|
|
||||||
|
|
||||||
# Add the custom components from the page to the set.
|
|
||||||
custom_components |= component._get_all_custom_components()
|
|
||||||
|
|
||||||
app_root = self._app_root(app_wrappers=app_wrappers)
|
app_root = self._app_root(app_wrappers=app_wrappers)
|
||||||
|
|
||||||
# Get imports from AppWrap components.
|
# Get imports from AppWrap components.
|
||||||
|
@ -1968,14 +1968,6 @@ class StatefulComponent(BaseComponent):
|
|||||||
"""
|
"""
|
||||||
from reflex.components.core.foreach import Foreach
|
from reflex.components.core.foreach import Foreach
|
||||||
|
|
||||||
if isinstance(component, CustomComponent):
|
|
||||||
# Do not memoize custom components.
|
|
||||||
return None
|
|
||||||
|
|
||||||
if component._get_app_wrap_components():
|
|
||||||
# Do not memoize app wrap components.
|
|
||||||
return None
|
|
||||||
|
|
||||||
if component._memoization_mode.disposition == MemoizationDisposition.NEVER:
|
if component._memoization_mode.disposition == MemoizationDisposition.NEVER:
|
||||||
# Never memoize this component.
|
# Never memoize this component.
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user