diff --git a/src/ink.tsx b/src/ink.tsx index 223c82fa..663ef628 100644 --- a/src/ink.tsx +++ b/src/ink.tsx @@ -77,17 +77,29 @@ export default class Ink { // so that it's rerendered every time, not just new static parts, like in non-debug mode this.fullStaticOutput = ''; + const rootTag = 1; + const hydrationCallbacks = null; + const isStrictMode = false; + const concurrentUpdatesByDefaultOverride = false; + const identifierPrefix = 'id'; + // TODO: Change error handling to noop. I've added this to more easily develop the reconciler + const onUncaughtError = console.error; + const onCaughtError = console.error; + const onRecoverableError = () => {}; + const transitionCallbacks = null; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.container = reconciler.createContainer( this.rootNode, - // Legacy mode - 0, - null, - false, - null, - 'id', - () => {}, - null, + rootTag, + hydrationCallbacks, + isStrictMode, + concurrentUpdatesByDefaultOverride, + identifierPrefix, + onUncaughtError, + onCaughtError, + onRecoverableError, + transitionCallbacks, ); // Unmount when process exits diff --git a/src/reconciler.ts b/src/reconciler.ts index 20ab138a..7f02be0a 100644 --- a/src/reconciler.ts +++ b/src/reconciler.ts @@ -2,7 +2,7 @@ import process from 'node:process'; import createReconciler from 'react-reconciler'; import { DefaultEventPriority, - NoEventPriority + NoEventPriority, } from 'react-reconciler/constants.js'; import Yoga, {type Node as YogaNode} from 'yoga-wasm-web/auto'; import { @@ -271,7 +271,8 @@ export default createReconciler< return {props, style}; }, - commitUpdate(node, {props, style}) { + commitUpdate(node, payload, type, oldProps, newProps) { + const {props, style} = newProps; if (props) { for (const [key, value] of Object.entries(props)) { if (key === 'style') { @@ -304,4 +305,8 @@ export default createReconciler< removeChildNode(node, removeNode); cleanupYogaNode(removeNode.yogaNode); }, + maySuspendCommit() { + // TODO: May return false here if we are confident that we don't need to suspend + return true; + }, });