Skip to content

Commit 25780ea

Browse files
committed
refactor(use-long-press): Remove unnecessary window check in useEffect
1 parent 394fdde commit 25780ea

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

packages/use-long-press/src/lib/use-long-press.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,6 @@ export function useLongPress<
301301

302302
// Listen to long press stop events on window
303303
useEffect(() => {
304-
// Do nothing if SSR
305-
if (!window) return;
306-
307304
function listener(event: LongPressDomEvents) {
308305
const reactEvent = createArtificialReactEvent<Target>(event);
309306
cancel()(reactEvent);

packages/use-long-press/src/tests/use-long-press.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ describe('Different environment compatibility', () => {
201201
beforeEach(() => {
202202
// Use fake timers for detecting long press
203203
vi.useFakeTimers();
204-
// Simulate absence of TouchEvent
204+
// Simulate absence of window
205205
vi.stubGlobal('window', undefined);
206206
});
207207

0 commit comments

Comments
 (0)