Skip to content

Commit 2291e1e

Browse files
committed
implement a faster hydration match for hoistable elements
1 parent fccf3a9 commit 2291e1e

File tree

6 files changed

+188
-128
lines changed

6 files changed

+188
-128
lines changed

packages/react-dom-bindings/src/client/ReactDOMComponentTree.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const internalEventHandlersKey = '__reactEvents$' + randomKey;
4747
const internalEventHandlerListenersKey = '__reactListeners$' + randomKey;
4848
const internalEventHandlesSetKey = '__reactHandles$' + randomKey;
4949
const internalRootNodeResourcesKey = '__reactResources$' + randomKey;
50-
const internalResourceMarker = '__reactMarker$' + randomKey;
50+
const internalHoistableMarker = '__reactMarker$' + randomKey;
5151

5252
export function detachDeletedInstance(node: Instance): void {
5353
// TODO: This function is only called on host components. I don't think all of
@@ -288,10 +288,16 @@ export function getResourcesFromRoot(root: HoistableRoot): RootResources {
288288
return resources;
289289
}
290290

291-
export function isMarkedResource(node: Node): boolean {
292-
return !!(node: any)[internalResourceMarker];
291+
export function isMarkedHoistable(node: Node): boolean {
292+
return !!(node: any)[internalHoistableMarker];
293293
}
294294

295-
export function markNodeAsResource(node: Node) {
296-
(node: any)[internalResourceMarker] = true;
295+
export function markNodeAsHoistable(node: Node) {
296+
(node: any)[internalHoistableMarker] = true;
297+
}
298+
299+
export function isOwnedInstance(node: Node): boolean {
300+
return !!(
301+
(node: any)[internalHoistableMarker] || (node: any)[internalInstanceKey]
302+
);
297303
}

0 commit comments

Comments
 (0)