From 341b7ce4ed10bdb1d8dc1b9c17b7bf6a7ea6c1a1 Mon Sep 17 00:00:00 2001 From: Jeri Peier Date: Thu, 25 Apr 2024 11:56:15 +0200 Subject: [PATCH] fix: enable next.js 14 support and add some upstream fixes (#2613) --- src/react/core/create-component.ts | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/react/core/create-component.ts b/src/react/core/create-component.ts index 1e944108e9..4a88a0a5b7 100644 --- a/src/react/core/create-component.ts +++ b/src/react/core/create-component.ts @@ -120,7 +120,6 @@ export interface Options { elementClass: Constructor; events?: E; displayName?: string; - renderAttributesOnCreate?: boolean; } type Constructor = { new (): T }; @@ -181,8 +180,10 @@ const setProperty = ( ) => { const event = events?.[name]; // Dirty check event value. - if (event !== undefined && value !== old) { - addOrUpdateEventListener(node, event, value as (e?: Event) => void); + if (event !== undefined) { + if (value !== old) { + addOrUpdateEventListener(node, event, value as (e?: Event) => void); + } return; } // But don't dirty check properties; elements are assumed to do this. @@ -253,7 +254,7 @@ export const createComponent = ; const ReactComponent = React.forwardRef((props, ref) => { - const prevPropsRef = React.useRef(null); + const prevElemPropsRef = React.useRef(new Map()); const elementRef = React.useRef(null); // Props to be passed to React.createElement @@ -308,20 +309,26 @@ export const createComponent =