File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
packages/svelte/tests/signals Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -740,6 +740,32 @@ describe('signals', () => {
740740 } ;
741741 } ) ;
742742
743+ test ( 'nested deriveds clean up the relationships when used with untrack' , ( ) => {
744+ return ( ) => {
745+ let a = render_effect ( ( ) => { } ) ;
746+
747+ const destroy = effect_root ( ( ) => {
748+ a = render_effect ( ( ) => {
749+ $ . untrack ( ( ) => {
750+ const b = derived ( ( ) => {
751+ const c = derived ( ( ) => { } ) ;
752+ $ . untrack ( ( ) => {
753+ $ . get ( c ) ;
754+ } ) ;
755+ } ) ;
756+ $ . get ( b ) ;
757+ } ) ;
758+ } ) ;
759+ } ) ;
760+
761+ assert . deepEqual ( a . deriveds ?. length , 1 ) ;
762+
763+ destroy ( ) ;
764+
765+ assert . deepEqual ( a . deriveds , null ) ;
766+ } ;
767+ } ) ;
768+
743769 test ( 'bigint states update correctly' , ( ) => {
744770 return ( ) => {
745771 const count = state ( 0n ) ;
You can’t perform that action at this time.
0 commit comments