Skip to content

Commit 2247a51

Browse files
nwidynskiLFDanLu
andauthored
fix: @react-stately/virtualizer dependencies (adobe#8724)
* fix: remove react-aria dependency * chore: update package.json * update yarn.lock --------- Co-authored-by: Daniel Lu <dl1644@gmail.com>
1 parent e717ee9 commit 2247a51

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/@react-stately/virtualizer/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"url": "https://github.com/adobe/react-spectrum"
2727
},
2828
"dependencies": {
29-
"@react-aria/utils": "^3.30.1",
3029
"@react-types/shared": "^3.32.0",
3130
"@swc/helpers": "^0.5.0"
3231
},

packages/@react-stately/virtualizer/src/useVirtualizerState.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@
1313
import {Collection, Key} from '@react-types/shared';
1414
import {InvalidationContext} from './types';
1515
import {Layout} from './Layout';
16+
import React, {useCallback, useMemo, useRef, useState} from 'react';
1617
import {Rect} from './Rect';
1718
import {ReusableView} from './ReusableView';
1819
import {Size} from './Size';
19-
import {useCallback, useMemo, useRef, useState} from 'react';
20-
import {useLayoutEffect} from '@react-aria/utils';
2120
import {Virtualizer} from './Virtualizer';
2221

22+
// During SSR, React emits a warning when calling useLayoutEffect.
23+
// Since neither useLayoutEffect nor useEffect run on the server,
24+
// we can suppress this by replace it with a noop on the server.
25+
export const useLayoutEffect: typeof React.useLayoutEffect = typeof document !== 'undefined'
26+
? React.useLayoutEffect
27+
: () => {};
28+
2329
interface VirtualizerProps<T extends object, V, O> {
2430
renderView(type: string, content: T | null): V,
2531
layout: Layout<T>,

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8390,7 +8390,6 @@ __metadata:
83908390
version: 0.0.0-use.local
83918391
resolution: "@react-stately/virtualizer@workspace:packages/@react-stately/virtualizer"
83928392
dependencies:
8393-
"@react-aria/utils": "npm:^3.30.1"
83948393
"@react-types/shared": "npm:^3.32.0"
83958394
"@swc/helpers": "npm:^0.5.0"
83968395
peerDependencies:

0 commit comments

Comments
 (0)