Skip to content

Commit 17fca44

Browse files
authored
Merge pull request #3284 from plotly/fix-cop-key
Fix component as props used in the same container getting the same key
2 parents 4031d0e + 9c45ff7 commit 17fca44

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
77
## Fixed
88
- [#3278](https://github.com/plotly/dash/pull/3278) Fix loading selector with children starting at the same digit. Fix [#3276](https://github.com/plotly/dash/issues/3276)
99
- [#3280](https://github.com/plotly/dash/pull/3280) Remove flask typing import not available in earlier versions.
10+
- [#3284](https://github.com/plotly/dash/pull/3284) Fix component as props having the same key when used in the same container.
1011

1112
## [3.0.3] - 2025-04-14
1213

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

+7-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import {
2828
createElement,
2929
getComponentLayout,
3030
isDryComponent,
31-
checkRenderTypeProp
31+
checkRenderTypeProp,
32+
stringifyPath
3233
} from './wrapping';
3334
import Registry from '../registry';
3435
import isSimpleComponent from '../isSimpleComponent';
@@ -158,17 +159,16 @@ function DashWrapper({
158159
};
159160

160161
const createContainer = useCallback(
161-
(container, containerPath, _childNewRender, key = undefined) => {
162+
(container, containerPath, _childNewRender) => {
162163
if (isSimpleComponent(renderComponent)) {
163164
return renderComponent;
164165
}
165166
return (
166167
<DashWrapper
167168
key={
168-
(container &&
169-
container.props &&
170-
stringifyId(container.props.id)) ||
171-
key
169+
container?.props?.id
170+
? stringifyId(container.props.id)
171+
: stringifyPath(containerPath)
172172
}
173173
_dashprivate_error={_dashprivate_error}
174174
componentPath={containerPath}
@@ -192,8 +192,7 @@ function DashWrapper({
192192
...childrenPath,
193193
i
194194
]),
195-
_childNewRender,
196-
i
195+
_childNewRender
197196
);
198197
}
199198
return n;

0 commit comments

Comments
 (0)