From ecc2f945d1444e19321da62ff026c2100e202b37 Mon Sep 17 00:00:00 2001 From: Jeremias Peier Date: Wed, 24 Apr 2024 08:56:49 +0200 Subject: [PATCH] fix: enable next.js 14 support --- src/react/core/create-component.ts | 35 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/react/core/create-component.ts b/src/react/core/create-component.ts index 1e944108e9..b42e955951 100644 --- a/src/react/core/create-component.ts +++ b/src/react/core/create-component.ts @@ -181,8 +181,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 +255,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 +310,26 @@ export const createComponent =