From b275d9b330b74d35bf2ce839ead3cdd3aa00cca3 Mon Sep 17 00:00:00 2001 From: itsMapleLeaf <19603573+itsMapleLeaf@users.noreply.github.com> Date: Sat, 23 Jul 2022 13:49:56 -0500 Subject: [PATCH] update reconciler --- packages/reacord/library/core/reacord.tsx | 14 +++++++++++++- packages/reacord/library/internal/reconciler.ts | 13 ++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/reacord/library/core/reacord.tsx b/packages/reacord/library/core/reacord.tsx index d402ffe..1dfede6 100644 --- a/packages/reacord/library/core/reacord.tsx +++ b/packages/reacord/library/core/reacord.tsx @@ -47,7 +47,19 @@ export abstract class Reacord { this.renderers.push(renderer) - const container = reconciler.createContainer(renderer, 0, false, {}) + const container = reconciler.createContainer( + renderer, + 0, + // eslint-disable-next-line unicorn/no-null + null, + false, + // eslint-disable-next-line unicorn/no-null + null, + "reacord", + () => {}, + // eslint-disable-next-line unicorn/no-null + null, + ) const instance: ReacordInstance = { render: (content: ReactNode) => { diff --git a/packages/reacord/library/internal/reconciler.ts b/packages/reacord/library/internal/reconciler.ts index 259f5f2..aaa61da 100644 --- a/packages/reacord/library/internal/reconciler.ts +++ b/packages/reacord/library/internal/reconciler.ts @@ -1,5 +1,6 @@ import type { HostConfig } from "react-reconciler" import ReactReconciler from "react-reconciler" +import { DefaultEventPriority } from "react-reconciler/constants" import { raise } from "../../helpers/raise.js" import { Node } from "./node.js" import type { Renderer } from "./renderers/renderer" @@ -20,8 +21,6 @@ const config: HostConfig< number, // TimeoutHandle, number // NoTimeout, > = { - // config - now: Date.now, supportsMutation: true, supportsPersistence: false, supportsHydration: false, @@ -52,8 +51,13 @@ const config: HostConfig< }, createTextInstance: (text) => new TextNode(text), shouldSetTextContent: () => false, - // @ts-expect-error detachDeletedInstance: (instance) => {}, + beforeActiveInstanceBlur: () => {}, + afterActiveInstanceBlur: () => {}, + // eslint-disable-next-line unicorn/no-null + getInstanceFromNode: (node: any) => null, + // eslint-disable-next-line unicorn/no-null + getInstanceFromScope: (scopeInstance: any) => null, clearContainer: (renderer) => { renderer.nodes.clear() @@ -94,11 +98,14 @@ const config: HostConfig< resetAfterCommit: (renderer) => { renderer.render() }, + prepareScopeUpdate: (scopeInstance: any, instance: any) => {}, preparePortalMount: () => raise("Portals are not supported"), getPublicInstance: () => raise("Refs are currently not supported"), finalizeInitialChildren: () => false, + + getCurrentEventPriority: () => DefaultEventPriority, } export const reconciler = ReactReconciler(config)