Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/react-dom-bindings/src/client/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3210,6 +3210,29 @@ export function hydrateProperties(
break;
}

// Custom elements need their props (including event handlers) re-applied
// during hydration because the server markup cannot capture property-based
// listeners. Mirror the client mount path used in setInitialProperties.
if (isCustomElement(tag, props)) {
for (const propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
const propValue = props[propKey];
if (propValue === undefined) {
continue;
}
setPropOnCustomElement(
domElement,
tag,
propKey,
propValue,
props,
undefined,
);
}
}

const children = props.children;
// For text content children we compare against textContent. This
// might match additional HTML that is hidden when we read it using
Expand Down
Loading