@@ -10,6 +10,7 @@ import {
1010 type ThunkDispatch ,
1111 type UnknownAction
1212} from '@reduxjs/toolkit' ;
13+ import { untrack } from 'svelte' ;
1314import type { ThinkingLevel , ModelType , PermissionMode } from '$lib/codegen/types' ;
1415import type { PullRequest } from '$lib/forge/interface/types' ;
1516import type { StackDetails } from '$lib/stacks/stack' ;
@@ -267,18 +268,20 @@ export class UiState {
267268 } ;
268269
269270 // If the value is an array of strings, we add methods to add/remove
270- if ( Array . isArray ( mutableResult ) && mutableResult . every ( isStr ) ) {
271- ( props [ key ] as GlobalProperty < string [ ] > ) . add = ( ...value : string [ ] ) => {
272- const current = mutableResult as string [ ] ;
273- mutableResult = [ ...current , ...value . filter ( ( v ) => ! current . includes ( v ) ) ] ;
274- this . update ( `${ id } :${ key } ` , mutableResult ) ;
275- } ;
276- ( props [ key ] as GlobalProperty < string [ ] > ) . remove = ( value : string ) => {
277- const current = mutableResult as string [ ] ;
278- mutableResult = current . filter ( ( v ) => v !== value ) ;
279- this . update ( `${ id } :${ key } ` , mutableResult ) ;
280- } ;
281- }
271+ untrack ( ( ) => {
272+ if ( Array . isArray ( mutableResult ) && mutableResult . every ( isStr ) ) {
273+ ( props [ key ] as GlobalProperty < string [ ] > ) . add = ( ...value : string [ ] ) => {
274+ const current = mutableResult as string [ ] ;
275+ mutableResult = [ ...current , ...value . filter ( ( v ) => ! current . includes ( v ) ) ] ;
276+ this . update ( `${ id } :${ key } ` , mutableResult ) ;
277+ } ;
278+ ( props [ key ] as GlobalProperty < string [ ] > ) . remove = ( value : string ) => {
279+ const current = mutableResult as string [ ] ;
280+ mutableResult = current . filter ( ( v ) => v !== value ) ;
281+ this . update ( `${ id } :${ key } ` , mutableResult ) ;
282+ } ;
283+ }
284+ } ) ;
282285 }
283286 scopeCache [ id ] = props as GlobalStore < T > ;
284287 return scopeCache [ id ] ;
0 commit comments