Skip to content

Commit 5932df4

Browse files
committed
fixes issue where components wouldnt remount when passed as a children prop
(cherry picked from commit cdd40ed)
1 parent 2ed9392 commit 5932df4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dash/dash-renderer/src/wrapper/DashWrapper.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function DashWrapper({
6565
const dispatch = useDispatch();
6666
const memoizedKeys: MutableRefObject<MemoizedKeysType> = useRef({});
6767
const newRender = useRef(false);
68+
const freshRenders = useRef(0);
6869
const renderedPath = useRef<DashLayoutPath>(componentPath);
6970
let renderComponent: any = null;
7071
let renderComponentProps: any = null;
@@ -85,6 +86,7 @@ function DashWrapper({
8586
if (_newRender) {
8687
newRender.current = true;
8788
renderH = 0;
89+
freshRenders.current += 1;
8890
if (renderH in memoizedKeys.current) {
8991
delete memoizedKeys.current[renderH];
9092
}
@@ -498,6 +500,7 @@ function DashWrapper({
498500
}
499501
error={_dashprivate_error}
500502
dispatch={dispatch}
503+
key={freshRenders.current}
501504
>
502505
<DashContextProvider componentPath={componentPath}>
503506
{React.isValidElement(hydrated) ? hydrated : <div />}

0 commit comments

Comments
 (0)