File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11import { SvelteSet } from "svelte/reactivity" ;
2+ import { untrack } from "svelte" ;
23
34export type Range = { min : number ; max : number } ;
45
@@ -41,9 +42,14 @@ export type AutocompleteTag = {
4142export class TagSet extends SvelteSet < string > {
4243 constructor ( private autocomplete : AutocompleteTag [ ] , tags : Set < string > = new Set ( ) ) {
4344 super ( tags ) ;
44- for ( const tag of this ) {
45- this . removeImplied ( tag ) ;
46- }
45+ // Svelte tracks changes inside a constructor,
46+ // so assigning TagSet to a state would cause an infinite loop if this weren't wrapped with `untrack`.
47+ // This should be fixed in a newer version of Svelte https://github.com/sveltejs/svelte/pull/15553
48+ untrack ( ( ) => {
49+ for ( const tag of this ) {
50+ this . removeImplied ( tag ) ;
51+ }
52+ } ) ;
4753 }
4854
4955 add ( tag : string ) {
You can’t perform that action at this time.
0 commit comments