Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
fix: respect scrollTo during resizing of grid container
Browse files Browse the repository at this point in the history
  • Loading branch information
rocwang committed Sep 27, 2022
1 parent 1de0fcf commit 4ef4689
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,11 @@ export function pipeline({
// endregion

// region: scroll to a given item by index
const scrollAction$: Observable<ScrollAction> = scrollTo$.pipe(
filter(complement(isNil)),
switchMap<number, Observable<[number, ResizeMeasurement, Element]>>(
(scrollTo) =>
combineLatest([of(scrollTo), resizeMeasurement$, rootResize$]).pipe(
take(1)
)
),
map<[number, ResizeMeasurement, Element], ScrollAction[]>(
const scrollToNotNil$:Observable<number> = scrollTo$.pipe( filter(complement(isNil)))
const scrollAction$: Observable<ScrollAction> = combineLatest(
[scrollToNotNil$, resizeMeasurement$, rootResize$]
).pipe(
mergeMap<[number, ResizeMeasurement, Element], ScrollAction[]>(
([scrollTo, resizeMeasurement, rootEl]) => {
const { vertical: verticalScrollEl, horizontal: horizontalScrollEl } =
getScrollParents(rootEl);
Expand Down Expand Up @@ -425,8 +421,7 @@ export function pipeline({
},
];
}
),
mergeAll()
)
);
// endregion

Expand Down

0 comments on commit 4ef4689

Please sign in to comment.