File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -198,16 +198,20 @@ export const useQueueStore = defineStore('queue', {
198198 this . pendingTasks = toClassAll ( queue . Pending )
199199
200200 // Process history items
201- const newHistoryItems = history . History . filter (
202- ( item ) => item . prompt [ 0 ] > this . lastHistoryQueueIndex
201+ const allIndex = new Set (
202+ history . History . map ( ( item : TaskItem ) => item . prompt [ 0 ] )
203203 )
204-
205- if ( newHistoryItems . length > 0 ) {
206- const newProcessedItems = toClassAll ( newHistoryItems )
207- this . historyTasks = [ ...newProcessedItems , ...this . historyTasks ]
208- . slice ( 0 , this . maxHistoryItems )
209- . sort ( ( a , b ) => b . queueIndex - a . queueIndex )
210- }
204+ const newHistoryItems = toClassAll (
205+ history . History . filter (
206+ ( item ) => item . prompt [ 0 ] > this . lastHistoryQueueIndex
207+ )
208+ )
209+ const existingHistoryItems = this . historyTasks . filter (
210+ ( item : TaskItemImpl ) => allIndex . has ( item . queueIndex )
211+ )
212+ this . historyTasks = [ ...newHistoryItems , ...existingHistoryItems ]
213+ . slice ( 0 , this . maxHistoryItems )
214+ . sort ( ( a , b ) => b . queueIndex - a . queueIndex )
211215 } ,
212216 async clear ( ) {
213217 await Promise . all (
You can’t perform that action at this time.
0 commit comments