Skip to content

Commit

Permalink
fix: children with the same key warning
Browse files Browse the repository at this point in the history
Bridge and Hook components were being created with the same key as children of the same parent
  • Loading branch information
JCourt1 authored and Bob Fanger committed Dec 9, 2022
1 parent fae87ed commit 4ace1b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "git",
"url": "https://github.com/bfanger/svelte-preprocess-react.git"
},
"version": "0.13.0",
"version": "0.14.0",
"license": "MIT",
"type": "module",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/lib/internal/Bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Bridge: React.FC<BridgeProps> = ({ createPortal, node }) => {
}
const children: React.ReactElement[] = node.nodes.map((subnode) => {
return React.createElement(Bridge, {
key: subnode.key,
key: `bridge${subnode.key}`,
createPortal,
node: subnode,
});
Expand All @@ -38,7 +38,9 @@ const Bridge: React.FC<BridgeProps> = ({ createPortal, node }) => {
}
if (hooks.length >= 0) {
children.push(
...hooks.map(({ Hook, key }) => React.createElement(Hook, { key }))
...hooks.map(({ Hook, key }) =>
React.createElement(Hook, { key: `hook${key}` })
)
);
}
return createPortal(
Expand Down

0 comments on commit 4ace1b6

Please sign in to comment.