Fix typescript issues

This commit is contained in:
2025-11-15 14:56:48 +01:00
parent 9ba37b3342
commit cc8c8fd414
2 changed files with 17 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
import React, { useRef, useState, useLayoutEffect, useCallback } from 'react';
import React, { useRef, useState, useCallback } from 'react';
import { Tree, type NodeApi } from 'react-arborist';
import {
IconFile,
@@ -23,15 +23,11 @@ interface FileTreeProps {
loadFileList: () => Promise<void>;
}
const useSize = (target: React.RefObject<HTMLElement>): Size | undefined => {
const useSize = (
target: React.RefObject<HTMLElement | null>
): Size | undefined => {
const [size, setSize] = useState<Size>();
useLayoutEffect(() => {
if (target.current) {
setSize(target.current.getBoundingClientRect());
}
}, [target]);
useResizeObserver(target, (entry) => setSize(entry.contentRect));
return size;
};