@@ -23,6 +23,7 @@ import {
23
23
useListStore ,
24
24
} from ' ~/stores/data/list.store' ;
25
25
import { useMovieStore , useMovieStoreRefs } from ' ~/stores/data/movie.store' ;
26
+ import { useExtensionSettingsStoreRefs } from ' ~/stores/settings/extension.store' ;
26
27
import { useLinksStore } from ' ~/stores/settings/links.store' ;
27
28
import { useI18n } from ' ~/utils/i18n.utils' ;
28
29
@@ -75,22 +76,22 @@ const collectedDate = computed(() => {
75
76
return getMovieCollectedDate (movieId .value )?.value ;
76
77
});
77
78
78
- onMounted (() => {
79
- watch (
80
- movieId ,
81
- id => {
82
- fetchMovie (id );
83
- },
84
- { immediate: true },
85
- );
86
- fetchMovieWatched ();
87
- fetchMovieCollected ();
79
+ const { myLists } = useListsStoreRefs ();
80
+ const {
81
+ isListTypeLoading,
82
+ isItemInList,
83
+ isItemListLoading,
84
+ addToOrRemoveFromList,
85
+ fetchAll,
86
+ } = useListStore ();
87
+
88
+ const { loadLists, loadListsPageSize } = useExtensionSettingsStoreRefs ();
89
+
90
+ const shouldFetchLists = computed (() => {
91
+ if (! myLists .value ?.length ) return false ;
92
+ return loadLists .value ;
88
93
});
89
94
90
- const { lists } = useListsStoreRefs ();
91
- const { isListTypeLoading, isItemInList, isItemListLoading, addToOrRemoveFromList } =
92
- useListStore ();
93
-
94
95
const listLoading = computed (
95
96
() =>
96
97
isListTypeLoading (ListType .Watchlist ).value || isListTypeLoading (ListType .List ).value ,
@@ -118,15 +119,15 @@ const watchedLoading = computed(() => {
118
119
119
120
const activeLists = computed (() => {
120
121
if (movieId ?.value === undefined ) return ;
121
- return lists .value
122
+ return myLists .value
122
123
?.filter (list => isItemInList (list .id , ' movie' , movieId .value ).value )
123
124
.map (list => list .id );
124
125
});
125
126
126
127
const onListUpdate = async (value : ListEntity [' id' ], remove : boolean ) => {
127
128
if (! movie .value ?.ids ) return ;
128
129
129
- const _list = lists .value .find (list => list .id === value );
130
+ const _list = myLists .value .find (list => list .id === value );
130
131
if (! _list ) return ;
131
132
132
133
await addToOrRemoveFromList ({
@@ -204,6 +205,29 @@ const titleUrl = computed(() => {
204
205
});
205
206
206
207
const { openTab } = useLinksStore ();
208
+
209
+ onMounted (() => {
210
+ watch (
211
+ movieId ,
212
+ id => {
213
+ fetchMovie (id );
214
+ },
215
+ { immediate: true },
216
+ );
217
+ fetchMovieWatched ();
218
+ fetchMovieCollected ();
219
+
220
+ if (shouldFetchLists .value ) {
221
+ fetchAll (
222
+ myLists .value .filter (
223
+ _active => loadLists .value ?.find (_list => _list .id === _active .id ),
224
+ ),
225
+ {
226
+ limit: loadListsPageSize .value ,
227
+ },
228
+ );
229
+ }
230
+ });
207
231
</script >
208
232
209
233
<template >
0 commit comments