Skip to content

Commit 35c7e8d

Browse files
authored
Ensures key is properly passed to importedElements
The "key" prop was being lost in the trickle-down of importedElements.
1 parent 178fc05 commit 35c7e8d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/js/packages/@reactpy/client/src/reactpy-vdom.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ export function createAttributes(
133133
model: ReactPyVdom,
134134
client: ReactPyClient,
135135
): { [key: string]: any } {
136+
// Add key to attributes
137+
if (model.key) {
138+
if (model.attributes) {
139+
model.attributes['key'] = model.key
140+
} else {
141+
model.attributes = {'key': model.key}
142+
}
143+
}
136144
return Object.fromEntries(
137145
Object.entries({
138146
// Normal HTML attributes

0 commit comments

Comments
 (0)