We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e92922 commit 7ec0294Copy full SHA for 7ec0294
packages/svelte/tests/signals/test.ts
@@ -781,4 +781,37 @@ describe('signals', () => {
781
assert.equal($.get(count), 0n);
782
};
783
});
784
+
785
+ test('unowned deriveds correctly re-attach to their source', () => {
786
+ const log: any[] = [];
787
788
+ return () => {
789
+ const a = state(0);
790
+ const b = state(0);
791
+ const c = derived(() => {
792
+ $.get(a);
793
+ return $.get(b)
794
+ });
795
796
+ $.get(c);
797
798
+ set(a, 1);
799
800
+ const destroy = effect_root(() => {
801
+ render_effect(() => {
802
+ log.push($.get(c));
803
804
805
806
+ assert.deepEqual(log, [0]);
807
808
+ set(b, 1);
809
810
+ flushSync();
811
812
+ assert.deepEqual(log, [0, 1]);
813
814
+ destroy();
815
+ };
816
817
0 commit comments