fix slow folder page

~ stabilize props: move isCurrent check to inside SongItem component
This commit is contained in:
geoffrey45
2022-12-06 23:49:14 +03:00
committed by Mungai Njoroge
parent 90dd1a1fe8
commit 0b24974a63
8 changed files with 20 additions and 38 deletions
+2 -7
View File
@@ -41,6 +41,7 @@ import useQueueStore from "@/stores/queue";
import FolderList from "@/components/FolderView/FolderList.vue";
import SongItem from "@/components/shared/SongItem.vue";
import { createTrackProps } from "@/utils";
const loader = useLoaderStore();
const folder = useFolderStore();
@@ -59,13 +60,7 @@ class songItem {
constructor(track: Track) {
this.id = Math.random();
this.props = {
track,
index: track.index + 1,
isCurrent: queue.currenttrackhash === track.trackhash,
isCurrentPlaying:
queue.currenttrackhash === track.trackhash && queue.playing,
};
this.props = createTrackProps(track)
}
}
-3
View File
@@ -38,7 +38,6 @@ const playlist = usePlaylistStore();
interface ScrollerItem {
id: string | number;
component: typeof Header | typeof SongItem;
// props: Record<string, unknown>;
size: number;
}
@@ -58,8 +57,6 @@ const scrollerItems = computed(() => {
props: {
track: track,
index: track.index + 1,
isCurrent: queue.currenttrackhash === track.trackhash,
isCurrentPlaying: queue.currenttrackhash === track.trackhash && queue.playing,
},
size: 64,
};
-4
View File
@@ -16,10 +16,6 @@
<SongItem
:track="item.track"
:index="index + 1"
:isCurrent="queue.currenttrackhash === item.track.trackhash"
:isCurrentPlaying="
queue.currenttrackhash === item.track.trackhash && queue.playing
"
@playThis="playFromQueue(index)"
/>
</RecycleScroller>