mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(core): add null checks for timeout refs and event listeners for React 19 compatibility (#9116)
## Description - Add null checks before clearTimeout calls in colorful-fallback.tsx, edgeless.dialog.tsx, and local.dialog.tsx - Fix event listener cleanup in unfolding.tsx - Update tsconfig.jsx to use react-jsx transform ## Testing - [x] Verified type safety improvements for React 19 compatibility - [x] Ensured proper cleanup of event listeners and timeouts - [x] Confirmed no unintended side effects from the changes Link to Devin run: https://app.devin.ai/sessions/2e790f3ea0d84402837ec6c3c6f83e4c
This commit is contained in:
@@ -4,6 +4,7 @@ import type {
|
||||
HTMLAttributes,
|
||||
MouseEvent,
|
||||
ReactElement,
|
||||
SVGAttributes,
|
||||
} from 'react';
|
||||
import { cloneElement, forwardRef, useCallback } from 'react';
|
||||
|
||||
@@ -53,7 +54,7 @@ export interface ButtonProps
|
||||
*
|
||||
* If `loading` is true, will be replaced by a spinner.(`prefixClassName` and `prefixStyle` still work)
|
||||
* */
|
||||
prefix?: ReactElement;
|
||||
prefix?: ReactElement<SVGAttributes<SVGElement>>;
|
||||
prefixClassName?: string;
|
||||
prefixStyle?: CSSProperties;
|
||||
contentClassName?: string;
|
||||
@@ -63,7 +64,7 @@ export interface ButtonProps
|
||||
* By default, it is considered as an icon with preset size and color,
|
||||
* can be overridden by `suffixClassName` and `suffixStyle`.
|
||||
* */
|
||||
suffix?: ReactElement;
|
||||
suffix?: ReactElement<SVGAttributes<SVGElement>>;
|
||||
suffixClassName?: string;
|
||||
suffixStyle?: CSSProperties;
|
||||
|
||||
@@ -79,7 +80,7 @@ const IconSlot = ({
|
||||
className,
|
||||
...attrs
|
||||
}: {
|
||||
icon?: ReactElement;
|
||||
icon?: ReactElement<SVGAttributes<SVGElement>>;
|
||||
loading?: boolean;
|
||||
} & HTMLAttributes<HTMLElement>) => {
|
||||
const showLoadingHere = loading !== undefined;
|
||||
@@ -91,7 +92,7 @@ const IconSlot = ({
|
||||
? cloneElement(icon, {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
...icon.props,
|
||||
...(icon.props as Record<string, unknown>),
|
||||
})
|
||||
: null}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user