File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,8 @@ export const chatSlice = createSlice({
380380 }
381381 } ,
382382 startNewThread : ( state ) => {
383+ // Clear existing tasks
384+ state . threads [ state . activeThread ] . tasks = [ ]
383385 if ( state . threads . length >= MAX_THREADS ) {
384386 const excessThreads = state . threads . length - MAX_THREADS + 1 ;
385387 state . threads . splice ( 0 , excessThreads ) ;
Original file line number Diff line number Diff line change @@ -472,11 +472,22 @@ const migrations = {
472472 newState . settings . metadataProcessingCache = { }
473473 return newState
474474 } ,
475+ 46 : ( state : RootState ) => {
476+ let newState = { ...state }
477+ // Clear tasks objects in all threads except latest
478+ const activeThreadIndex = newState . chat . activeThread
479+ newState . chat . threads . forEach ( ( thread , index : number ) => {
480+ if ( index !== activeThreadIndex ) {
481+ thread . tasks = [ ]
482+ }
483+ } )
484+ return newState
485+ } ,
475486}
476487
477488const persistConfig = {
478489 key : 'root' ,
479- version : 45 ,
490+ version : 46 ,
480491 storage,
481492 blacklist : [ 'billing' , 'cache' , userStateApi . reducerPath ] ,
482493 // @ts -ignore
You can’t perform that action at this time.
0 commit comments