fix: 🐛 Fix slide sync on initial timeline load

This commit is contained in:
ThatOneCalculator 2022-09-09 11:06:18 -07:00
parent f08c04cdb1
commit 11a5a99a6f
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "12.118.1-calc.2-beta.2-rc.17", "version": "12.118.1-calc.2-rc.18",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -127,7 +127,7 @@ const rootEl = $ref<HTMLElement>();
let queue = $ref(0); let queue = $ref(0);
const src = $computed({ const src = $computed({
get: () => defaultStore.reactiveState.tl.value.src, get: () => getSrc(),
set: (x) => { set: (x) => {
saveSrc(x); saveSrc(x);
syncSlide(timelines.indexOf(x)); syncSlide(timelines.indexOf(x));
@ -278,6 +278,12 @@ function setSwiperRef(swiper) {
swiperRef = swiper; swiperRef = swiper;
} }
function getSrc(): 'home' | 'local' | 'recommended' | 'social' | 'global' {
const dSrc = defaultStore.state.tl.src;
syncSlide(dSrc);
return dSrc;
}
function onSlideChange() { function onSlideChange() {
saveSrc(timelines[swiperRef.activeIndex]); saveSrc(timelines[swiperRef.activeIndex]);
} }