Skip to content

Commit d97d1d9

Browse files
authored
add recursive memoization to auto scroll if key is provided (#4859)
1 parent a5cd3f1 commit d97d1d9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

reflex/components/core/auto_scroll.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
import dataclasses
6+
57
from reflex.components.el.elements.typography import Div
68
from reflex.constants.compiler import MemoizationDisposition, MemoizationMode
79
from reflex.utils.imports import ImportDict
@@ -28,7 +30,12 @@ def create(cls, *children, **props):
2830
"""
2931
props.setdefault("overflow", "auto")
3032
props.setdefault("id", get_unique_variable_name())
31-
return super().create(*children, **props)
33+
component = super().create(*children, **props)
34+
if "key" in props:
35+
component._memoization_mode = dataclasses.replace(
36+
component._memoization_mode, recursive=True
37+
)
38+
return component
3239

3340
def add_imports(self) -> ImportDict | list[ImportDict]:
3441
"""Add imports required for the component.

0 commit comments

Comments
 (0)