Skip to content

Commit 9d2cd38

Browse files
committed
chore: fix infinitegrid lint
1 parent ecbe578 commit 9d2cd38

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

packages/infinitegrid/src/InfiniteGrid.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,15 +929,17 @@ class InfiniteGrid<Options extends InfiniteGridOptions = InfiniteGridOptions> ex
929929

930930
// 같아야 비교대상이 되고 위치 보정이 가능하다.
931931
const nextParts = nextVisibleArea?.parts ?? [];
932+
const prevVisibleParts = prevParts.filter(p => p.pos !== INVISIBLE_POS);
933+
const nextVisibleParts = nextParts.filter(p => p.pos !== INVISIBLE_POS);
932934
if (
933935
nextVisibleArea
934936
// 커서가 시작이 아니어야 그룹들의 위치 보정이 가능하다.
935937
// startCursor가 0이면 위의 아이템들의 위치가 심각하게 흔들릴 가능성이 매우 높다.
936938
&& prevStartCursor > 0
937939
// 기존 개수가 같아야 하고
938-
&& nextParts.length === prevParts.length
940+
&& prevParts.length === nextParts.length
939941
// 혹시 중간에 위치가 초기화된 케이스가 없어야 한다.
940-
&& nextParts.filter(p => p.pos !== INVISIBLE_POS).length === prevParts.filter(p => p.pos !== INVISIBLE_POS).length
942+
&& prevVisibleParts.length === nextVisibleParts.length
941943
) {
942944
let offset = nextVisibleArea.centerPos - prevVisibleArea.centerPos;
943945

packages/infinitegrid/test/unit/InfiniteGrid.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ describe("test InfiniteGrid", () => {
15881588
expect(correctedPos).to.be.equals(950);
15891589
});
15901590
});
1591-
it.only(`should check if scroll position is corrected when size, pos, window size is changed (startCursor = 0)`, async () => {
1591+
it(`should check if scroll position is corrected when size, pos, window size is changed (startCursor = 0)`, async () => {
15921592
// Given
15931593
ig!.syncItems([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17].map((child) => {
15941594
return {
@@ -1629,7 +1629,7 @@ describe("test InfiniteGrid", () => {
16291629
expect(ig!.getStartCursor()).to.be.equals(0);
16301630
expect(ig!.getEndCursor()).to.be.equals(1);
16311631
});
1632-
it.only(`should check if scroll position is corrected when size, pos, window size is changed (startCursor > 0)`, async () => {
1632+
it(`should check if scroll position is corrected when size, pos, window size is changed (startCursor > 0)`, async () => {
16331633
// Given
16341634
ig!.syncItems([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17].map((child) => {
16351635
return {

0 commit comments

Comments
 (0)