Skip to content

Commit b9f7118

Browse files
committed
fix(list): restore scroll-top if loading with offset
1 parent b6dae1d commit b9f7118

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils/calendar.utils.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DateUtils } from '@dvcol/common-utils/common/date';
2-
import { computed, ref, type Ref, watch } from 'vue';
2+
import { computed, nextTick, type Ref, ref, watch } from 'vue';
33

44
import type { TraktCalendarMovie, TraktCalendarShow } from '@dvcol/trakt-http-client/models';
55

@@ -179,8 +179,10 @@ export const useCalendar = ({
179179
await fetching;
180180

181181
clearTimeout(timeout);
182+
const currentScrollTop = listRef.value?.list?.$el?.firstElementChild?.scrollTop ?? 0;
183+
await nextTick();
182184
listRef.value?.list.scrollTo({
183-
top: (list.value.findIndex(item => item.id === first.id) - placeholder) * itemSize,
185+
top: currentScrollTop + (list.value.findIndex(item => item.id === first.id) - placeholder) * itemSize,
184186
});
185187
placeholder = 0;
186188
};

0 commit comments

Comments
 (0)