Skip to content

Commit 1139cfa

Browse files
perf(web): useResizableWidth compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit 1139cfa

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

‎apps/web/src/hooks/useResizableWidth.ts‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import * as Schema from "effect/Schema";
2-
import {
3-
type PointerEvent as ReactPointerEvent,
4-
useCallback,
5-
useLayoutEffect,
6-
useRef,
7-
useState,
8-
} from "react";
2+
import { type PointerEvent as ReactPointerEvent, useLayoutEffect, useRef, useState } from "react";
93

104
import { getLocalStorageItem, setLocalStorageItem } from "./useLocalStorage";
115
import { useResizeDrag } from "./useResizeDrag";
@@ -43,13 +37,10 @@ export function useResizableWidth(options: UseResizableWidthOptions): {
4337
} {
4438
const { storageKey, defaultWidth, minWidth, maxWidth, edge } = options;
4539

46-
const clamp = useCallback(
47-
(value: number): number => {
48-
if (!Number.isFinite(value)) return defaultWidth;
49-
return Math.max(minWidth, Math.min(maxWidth, value));
50-
},
51-
[defaultWidth, maxWidth, minWidth],
52-
);
40+
const clamp = (value: number): number => {
41+
if (!Number.isFinite(value)) return defaultWidth;
42+
return Math.max(minWidth, Math.min(maxWidth, value));
43+
};
5344

5445
const readWidth = () => {
5546
if (typeof window === "undefined") return defaultWidth;

0 commit comments

Comments
 (0)