fix: restore interactive OpenAI REPL on React 18

This commit is contained in:
Kevin
2026-04-01 09:47:21 +08:00
parent e69cf0917e
commit 770e16dadb
7 changed files with 92 additions and 155 deletions

View File

@@ -232,7 +232,7 @@ const reconciler = createReconciler<
unknown,
DOMElement,
HostContext,
null, // UpdatePayload - not used in React 19
boolean,
NodeJS.Timeout,
-1,
null
@@ -398,6 +398,14 @@ const reconciler = createReconciler<
): boolean {
return props['autoFocus'] === true
},
prepareUpdate(
_node: DOMElement,
_type: ElementNames,
oldProps: Props,
newProps: Props,
): boolean {
return oldProps !== newProps
},
commitMount(node: DOMElement): void {
getFocusManager(node).handleAutoFocus(node)
},
@@ -422,9 +430,9 @@ const reconciler = createReconciler<
cleanupYogaNode(removeNode)
getFocusManager(node).handleNodeRemoved(removeNode, node)
},
// React 19 commitUpdate receives old and new props directly instead of an updatePayload
commitUpdate(
node: DOMElement,
_updatePayload: boolean,
_type: ElementNames,
oldProps: Props,
newProps: Props,