@@ -122,7 +122,6 @@ export const useAssetsStore = defineStore('assets', () => {
122122 const allHistoryItems = ref < AssetItem [ ] > ( [ ] )
123123
124124 const loadedIds = shallowReactive ( new Set < string > ( ) )
125- const loadedJobIds = new Set < string > ( )
126125
127126 const fetchInputFiles = isCloud
128127 ? fetchInputFilesFromCloud
@@ -157,17 +156,12 @@ export const useAssetsStore = defineStore('assets', () => {
157156 hasMoreHistory . value = true
158157 allHistoryItems . value = [ ]
159158 loadedIds . clear ( )
160- loadedJobIds . clear ( )
161159 }
162160
163161 const history = await api . getHistory ( BATCH_SIZE , {
164162 offset : historyOffset . value
165163 } )
166164
167- for ( const job of history ) {
168- loadedJobIds . add ( job . id )
169- }
170-
171165 const newAssets = mapHistoryToAssets ( history )
172166
173167 if ( loadMore ) {
@@ -267,6 +261,7 @@ export const useAssetsStore = defineStore('assets', () => {
267261 const flatOutputSeenIds = new Set < string > ( )
268262 let flatOutputRefreshInFlight : Promise < AssetItem [ ] > | null = null
269263 let flatOutputLoadMoreInFlight : Promise < AssetItem [ ] > | null = null
264+ let flatOutputGeneration = 0
270265
271266 async function fetchFlatOutputs ( loadMore : boolean ) : Promise < AssetItem [ ] > {
272267 if ( loadMore ) {
@@ -275,19 +270,25 @@ export const useAssetsStore = defineStore('assets', () => {
275270 flatOutputIsLoadingMore . value = true
276271 } else {
277272 if ( flatOutputRefreshInFlight ) return flatOutputRefreshInFlight
273+ flatOutputGeneration ++
278274 flatOutputLoading . value = true
279275 flatOutputOffset . value = 0
280276 flatOutputHasMore . value = true
281277 flatOutputSeenIds . clear ( )
282278 }
283279 flatOutputError . value = null
284280
281+ const generation = flatOutputGeneration
282+
285283 const inFlight = ( async ( ) => {
286284 try {
287285 const page = await assetService . getAssetsByTag ( OUTPUT_TAG , true , {
288286 limit : FLAT_OUTPUT_PAGE_SIZE ,
289287 offset : flatOutputOffset . value
290288 } )
289+ if ( loadMore && generation !== flatOutputGeneration ) {
290+ return flatOutputAssets . value
291+ }
291292 const fresh = loadMore
292293 ? page . filter ( ( asset ) => ! flatOutputSeenIds . has ( asset . id ) )
293294 : page
0 commit comments