Skip to content

Commit 6aee8e3

Browse files
committed
Refactor
1 parent 61c5127 commit 6aee8e3

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/solid/VList.tsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ export interface VListProps<T>
3838
*/
3939
export const VList = <T,>(props: VListProps<T>): JSX.Element => {
4040
const {
41-
ref: _ref,
42-
data: _data,
43-
children: _children,
44-
overscan: _overscan,
41+
ref,
42+
data,
43+
children,
44+
overscan,
4545
itemSize,
46-
shift: _shift,
47-
horizontal = false,
48-
onScroll: _onScroll,
49-
onScrollEnd: _onScrollEnd,
50-
onRangeChange: _onRangeChange,
51-
style: _style,
46+
shift,
47+
horizontal,
48+
onScroll,
49+
onScrollEnd,
50+
onRangeChange,
51+
style,
5252
...attrs
5353
} = props;
5454

src/solid/Virtualizer.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { createScroller } from "../core/scroller";
3030
import { ItemsRange, ScrollToIndexOpts } from "../core/types";
3131
import { ListItem } from "./ListItem";
3232
import { RangedFor } from "./RangedFor";
33-
import { exists } from "../core/utils";
3433
import { isSameRange } from "./utils";
3534

3635
/**
@@ -257,9 +256,9 @@ export const Virtualizer = <T,>(props: VirtualizerProps<T>): JSX.Element => {
257256
createComputed(
258257
on(
259258
() => props.data.length,
260-
(len, prevLen) => {
261-
if (exists(prevLen) && len !== prevLen) {
262-
store._update(ACTION_ITEMS_LENGTH_CHANGE, [len, props.shift]);
259+
(count) => {
260+
if (count !== store._getItemsLength()) {
261+
store._update(ACTION_ITEMS_LENGTH_CHANGE, [count, props.shift]);
263262
}
264263
}
265264
)

0 commit comments

Comments
 (0)