@tanstack/solid-query-persist-client 6.0.0-alpha.2 → 6.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -5,7 +5,7 @@ import { QueryClientProvider, IsRestoringContext } from '@tanstack/solid-query';
5
5
 
6
6
  // src/index.ts
7
7
 
8
- // ../../node_modules/.pnpm/@solidjs+signals@0.13.6/node_modules/@solidjs/signals/dist/prod.js
8
+ // ../../node_modules/.pnpm/@solidjs+signals@0.13.9/node_modules/@solidjs/signals/dist/prod.js
9
9
  var NotReadyError = class extends Error {
10
10
  source;
11
11
  constructor(e) {
@@ -567,39 +567,125 @@ function assignOrMergeLane(e, t) {
567
567
  }
568
568
  e.q = t;
569
569
  }
570
+ function unlinkSubs(e) {
571
+ const t = e.m;
572
+ const n = e.D;
573
+ const i = e.p;
574
+ const r = e.Ie;
575
+ if (i !== null) i.Ie = r;
576
+ else t.pe = r;
577
+ if (r !== null) r.p = i;
578
+ else {
579
+ t.I = i;
580
+ if (i === null) {
581
+ t.he?.();
582
+ t.L && !t.Ae && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
583
+ }
584
+ }
585
+ return n;
586
+ }
587
+ function unobserved(e) {
588
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
589
+ let t = e.C;
590
+ while (t !== null) {
591
+ t = unlinkSubs(t);
592
+ }
593
+ e.C = null;
594
+ disposeChildren(e, true);
595
+ }
596
+ function markDisposal(e) {
597
+ let t = e.Pe;
598
+ while (t) {
599
+ t.O |= REACTIVE_ZOMBIE;
600
+ if (t.O & REACTIVE_IN_HEAP) {
601
+ deleteFromHeap(t, dirtyQueue);
602
+ insertIntoHeap(t, zombieQueue);
603
+ }
604
+ markDisposal(t);
605
+ t = t.ge;
606
+ }
607
+ }
608
+ function disposeChildren(e, t = false, n) {
609
+ if (e.O & REACTIVE_DISPOSED) return;
610
+ if (t) e.O = REACTIVE_DISPOSED;
611
+ if (t && e.L) e.Ce = null;
612
+ let i = n ? e.De : e.Pe;
613
+ while (i) {
614
+ const e2 = i.ge;
615
+ if (i.C) {
616
+ const e3 = i;
617
+ deleteFromHeap(e3, e3.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
618
+ let t2 = e3.C;
619
+ do {
620
+ t2 = unlinkSubs(t2);
621
+ } while (t2 !== null);
622
+ e3.C = null;
623
+ e3.Ne = null;
624
+ }
625
+ disposeChildren(i, true);
626
+ i = e2;
627
+ }
628
+ if (n) {
629
+ e.De = null;
630
+ } else {
631
+ e.Pe = null;
632
+ e.ye = 0;
633
+ }
634
+ runDisposal(e, n);
635
+ }
636
+ function runDisposal(e, t) {
637
+ let n = t ? e.ve : e.me;
638
+ if (!n) return;
639
+ if (Array.isArray(n)) {
640
+ for (let e2 = 0; e2 < n.length; e2++) {
641
+ const t2 = n[e2];
642
+ t2.call(t2);
643
+ }
644
+ } else {
645
+ n.call(n);
646
+ }
647
+ t ? e.ve = null : e.me = null;
648
+ }
649
+ function cleanup(e) {
650
+ if (!context) return e;
651
+ if (!context.me) context.me = e;
652
+ else if (Array.isArray(context.me)) context.me.push(e);
653
+ else context.me = [context.me, e];
654
+ return e;
655
+ }
570
656
  function addPendingSource(e, t) {
571
- if (e.Ie === t || e.pe?.has(t)) return false;
572
- if (!e.Ie) {
573
- e.Ie = t;
657
+ if (e.be === t || e.Le?.has(t)) return false;
658
+ if (!e.be) {
659
+ e.be = t;
574
660
  return true;
575
661
  }
576
- if (!e.pe) {
577
- e.pe = /* @__PURE__ */ new Set([e.Ie, t]);
662
+ if (!e.Le) {
663
+ e.Le = /* @__PURE__ */ new Set([e.be, t]);
578
664
  } else {
579
- e.pe.add(t);
665
+ e.Le.add(t);
580
666
  }
581
- e.Ie = void 0;
667
+ e.be = void 0;
582
668
  return true;
583
669
  }
584
670
  function removePendingSource(e, t) {
585
- if (e.Ie) {
586
- if (e.Ie !== t) return false;
587
- e.Ie = void 0;
671
+ if (e.be) {
672
+ if (e.be !== t) return false;
673
+ e.be = void 0;
588
674
  return true;
589
675
  }
590
- if (!e.pe?.delete(t)) return false;
591
- if (e.pe.size === 1) {
592
- e.Ie = e.pe.values().next().value;
593
- e.pe = void 0;
594
- } else if (e.pe.size === 0) {
595
- e.pe = void 0;
676
+ if (!e.Le?.delete(t)) return false;
677
+ if (e.Le.size === 1) {
678
+ e.be = e.Le.values().next().value;
679
+ e.Le = void 0;
680
+ } else if (e.Le.size === 0) {
681
+ e.Le = void 0;
596
682
  }
597
683
  return true;
598
684
  }
599
685
  function clearPendingSources(e) {
600
- e.Ie = void 0;
601
- e.pe?.clear();
602
- e.pe = void 0;
686
+ e.be = void 0;
687
+ e.Le?.clear();
688
+ e.Le = void 0;
603
689
  }
604
690
  function setPendingError(e, t, n) {
605
691
  if (!t) {
@@ -628,7 +714,7 @@ function settlePendingSource(e) {
628
714
  if (n.has(i) || !removePendingSource(i, e)) return;
629
715
  n.add(i);
630
716
  i.Ee = clock;
631
- const r = i.Ie ?? i.pe?.values().next().value;
717
+ const r = i.be ?? i.Le?.values().next().value;
632
718
  if (r) {
633
719
  setPendingError(i, r);
634
720
  updatePendingSignal(i);
@@ -636,7 +722,7 @@ function settlePendingSource(e) {
636
722
  i.Se &= ~STATUS_PENDING;
637
723
  setPendingError(i);
638
724
  updatePendingSignal(i);
639
- if (i.he) {
725
+ if (i.Ue) {
640
726
  if (i.W === EFFECT_TRACKED) {
641
727
  const e2 = i;
642
728
  if (!e2.H) {
@@ -650,7 +736,7 @@ function settlePendingSource(e) {
650
736
  }
651
737
  t = true;
652
738
  }
653
- i.he = false;
739
+ i.Ue = false;
654
740
  }
655
741
  forEachDependent(i, settle);
656
742
  };
@@ -662,19 +748,19 @@ function handleAsync(e, t, n) {
662
748
  const r = i && untrack(() => t[Symbol.asyncIterator]);
663
749
  const s = !r && i && untrack(() => typeof t.then === "function");
664
750
  if (!s && !r) {
665
- e.Ae = null;
751
+ e.Ce = null;
666
752
  return t;
667
753
  }
668
- e.Ae = t;
754
+ e.Ce = t;
669
755
  let o;
670
756
  const handleError = (n2) => {
671
- if (e.Ae !== t) return;
757
+ if (e.Ce !== t) return;
672
758
  globalQueue.initTransition(resolveTransition(e));
673
759
  notifyStatus(e, n2 instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n2);
674
760
  e.Ee = clock;
675
761
  };
676
762
  const asyncWrite = (i2, r2) => {
677
- if (e.Ae !== t) return;
763
+ if (e.Ce !== t) return;
678
764
  if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
679
765
  globalQueue.initTransition(resolveTransition(e));
680
766
  clearStatus(e);
@@ -689,12 +775,12 @@ function handleAsync(e, t, n) {
689
775
  e.Ee = clock;
690
776
  } else if (s2) {
691
777
  const t2 = e.J;
692
- const n2 = e.Ne;
778
+ const n2 = e.ke;
693
779
  if (!n2 || !n2(i2, t2)) {
694
780
  e.J = i2;
695
781
  e.Ee = clock;
696
- if (e.Pe) {
697
- setSignal(e.Pe, i2);
782
+ if (e.Ge) {
783
+ setSignal(e.Ge, i2);
698
784
  }
699
785
  insertSubs(e, true);
700
786
  }
@@ -728,33 +814,53 @@ function handleAsync(e, t, n) {
728
814
  if (r) {
729
815
  const n2 = t[Symbol.asyncIterator]();
730
816
  let i2 = false;
817
+ let r2 = false;
818
+ cleanup(() => {
819
+ if (r2) return;
820
+ r2 = true;
821
+ try {
822
+ const e2 = n2.return?.();
823
+ if (e2 && typeof e2.then === "function") {
824
+ e2.then(void 0, () => {
825
+ });
826
+ }
827
+ } catch {
828
+ }
829
+ });
731
830
  const iterate = () => {
732
- let e2, t2 = false, r3 = true;
831
+ let s3, u = false, c = true;
733
832
  n2.next().then(
734
833
  (n3) => {
735
- if (r3) {
736
- e2 = n3;
737
- t2 = true;
834
+ if (c) {
835
+ s3 = n3;
836
+ u = true;
837
+ if (n3.done) r2 = true;
838
+ } else if (e.Ce !== t) {
839
+ return;
738
840
  } else if (!n3.done) asyncWrite(n3.value, iterate);
739
841
  else {
842
+ r2 = true;
740
843
  schedule();
741
844
  flush();
742
845
  }
743
846
  },
744
- (e3) => {
745
- if (!r3) handleError(e3);
847
+ (n3) => {
848
+ if (!c && e.Ce === t) {
849
+ r2 = true;
850
+ handleError(n3);
851
+ }
746
852
  }
747
853
  );
748
- r3 = false;
749
- if (t2 && !e2.done) {
750
- o = e2.value;
854
+ c = false;
855
+ if (u && !s3.done) {
856
+ o = s3.value;
751
857
  i2 = true;
752
858
  return iterate();
753
859
  }
754
- return t2 && e2.done;
860
+ return u && s3.done;
755
861
  };
756
- const r2 = iterate();
757
- if (!i2 && !r2) {
862
+ const s2 = iterate();
863
+ if (!i2 && !s2) {
758
864
  globalQueue.initTransition(resolveTransition(e));
759
865
  throw new NotReadyError(context);
760
866
  }
@@ -763,11 +869,11 @@ function handleAsync(e, t, n) {
763
869
  }
764
870
  function clearStatus(e, t = false) {
765
871
  clearPendingSources(e);
766
- e.he = false;
872
+ e.Ue = false;
767
873
  e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
768
874
  setPendingError(e);
769
875
  updatePendingSignal(e);
770
- e.ge?.();
876
+ e.xe?.();
771
877
  }
772
878
  function notifyStatus(e, t, n, i, r) {
773
879
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
@@ -793,104 +899,26 @@ function notifyStatus(e, t, n, i, r) {
793
899
  }
794
900
  const a = i || c;
795
901
  const f = i || u ? void 0 : r;
796
- if (e.ge) {
902
+ if (e.xe) {
797
903
  if (i && t === STATUS_PENDING) {
798
904
  return;
799
905
  }
800
906
  if (a) {
801
- e.ge(t, n);
907
+ e.xe(t, n);
802
908
  } else {
803
- e.ge();
909
+ e.xe();
804
910
  }
805
911
  return;
806
912
  }
807
913
  forEachDependent(e, (e2) => {
808
914
  e2.Ee = clock;
809
- if (t === STATUS_PENDING && s && e2.Ie !== s && !e2.pe?.has(s) || t !== STATUS_PENDING && (e2.le !== n || e2.Ie || e2.pe)) {
915
+ if (t === STATUS_PENDING && s && e2.be !== s && !e2.Le?.has(s) || t !== STATUS_PENDING && (e2.le !== n || e2.be || e2.Le)) {
810
916
  if (!a && !e2.K) globalQueue.se.push(e2);
811
917
  notifyStatus(e2, t, n, a, f);
812
918
  }
813
919
  });
814
920
  }
815
921
  var externalSourceConfig = null;
816
- function markDisposal(e) {
817
- let t = e.Ce;
818
- while (t) {
819
- t.O |= REACTIVE_ZOMBIE;
820
- if (t.O & REACTIVE_IN_HEAP) {
821
- deleteFromHeap(t, dirtyQueue);
822
- insertIntoHeap(t, zombieQueue);
823
- }
824
- markDisposal(t);
825
- t = t.De;
826
- }
827
- }
828
- function disposeChildren(e, t = false, n) {
829
- if (e.O & REACTIVE_DISPOSED) return;
830
- if (t) e.O = REACTIVE_DISPOSED;
831
- let i = n ? e.me : e.Ce;
832
- while (i) {
833
- const e2 = i.De;
834
- if (i.C) {
835
- const e3 = i;
836
- deleteFromHeap(e3, e3.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
837
- let t2 = e3.C;
838
- do {
839
- t2 = unlinkSubs(t2);
840
- } while (t2 !== null);
841
- e3.C = null;
842
- e3.ye = null;
843
- }
844
- disposeChildren(i, true);
845
- i = e2;
846
- }
847
- if (n) {
848
- e.me = null;
849
- } else {
850
- e.Ce = null;
851
- e.ve = 0;
852
- }
853
- runDisposal(e, n);
854
- }
855
- function runDisposal(e, t) {
856
- let n = t ? e.we : e.be;
857
- if (!n) return;
858
- if (Array.isArray(n)) {
859
- for (let e2 = 0; e2 < n.length; e2++) {
860
- const t2 = n[e2];
861
- t2.call(t2);
862
- }
863
- } else {
864
- n.call(n);
865
- }
866
- t ? e.we = null : e.be = null;
867
- }
868
- function unlinkSubs(e) {
869
- const t = e.m;
870
- const n = e.D;
871
- const i = e.p;
872
- const r = e.Ue;
873
- if (i !== null) i.Ue = r;
874
- else t.ke = r;
875
- if (r !== null) r.p = i;
876
- else {
877
- t.I = i;
878
- if (i === null) {
879
- t.Ge?.();
880
- t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
881
- }
882
- }
883
- return n;
884
- }
885
- function unobserved(e) {
886
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
887
- let t = e.C;
888
- while (t !== null) {
889
- t = unlinkSubs(t);
890
- }
891
- e.C = null;
892
- disposeChildren(e, true);
893
- }
894
922
  GlobalQueue.oe = recompute;
895
923
  GlobalQueue.ue = disposeChildren;
896
924
  var tracking = false;
@@ -902,14 +930,15 @@ function recompute(e, t = false) {
902
930
  if (e.K && (!n || activeTransition) && activeTransition !== e.K)
903
931
  globalQueue.initTransition(e.K);
904
932
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
933
+ e.Ce = null;
905
934
  if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
906
935
  else {
907
936
  markDisposal(e);
908
- e.we = e.be;
909
- e.me = e.Ce;
910
- e.be = null;
911
- e.Ce = null;
912
- e.ve = 0;
937
+ e.ve = e.me;
938
+ e.De = e.Pe;
939
+ e.me = null;
940
+ e.Pe = null;
941
+ e.ye = 0;
913
942
  }
914
943
  }
915
944
  const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
@@ -917,7 +946,7 @@ function recompute(e, t = false) {
917
946
  const s = !!(e.Se & STATUS_PENDING);
918
947
  const o = context;
919
948
  context = e;
920
- e.ye = null;
949
+ e.Ne = null;
921
950
  e.O = REACTIVE_RECOMPUTING_DEPS;
922
951
  e.Ee = clock;
923
952
  let u = e.X === NOT_PENDING ? e.J : e.X;
@@ -946,7 +975,7 @@ function recompute(e, t = false) {
946
975
  updatePendingSignal(t3.te);
947
976
  }
948
977
  }
949
- if (t2 instanceof NotReadyError) e.he = true;
978
+ if (t2 instanceof NotReadyError) e.Ue = true;
950
979
  notifyStatus(
951
980
  e,
952
981
  t2 instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
@@ -960,7 +989,7 @@ function recompute(e, t = false) {
960
989
  context = o;
961
990
  }
962
991
  if (!e.le) {
963
- const o2 = e.ye;
992
+ const o2 = e.Ne;
964
993
  let a2 = o2 !== null ? o2.D : e.C;
965
994
  if (a2 !== null) {
966
995
  do {
@@ -970,7 +999,7 @@ function recompute(e, t = false) {
970
999
  else e.C = null;
971
1000
  }
972
1001
  const f2 = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
973
- const l = !e.Ne || !e.Ne(f2, u);
1002
+ const l = !e.ke || !e.ke(f2, u);
974
1003
  if (l) {
975
1004
  const o3 = r ? e.ee : void 0;
976
1005
  if (t || n && activeTransition !== e.K || i) {
@@ -1011,7 +1040,7 @@ function setSignal(e, t) {
1011
1040
  const i = e.ee !== void 0 && e.ee !== NOT_PENDING;
1012
1041
  const r = n ? i ? e.ee : e.J : e.X === NOT_PENDING ? e.J : e.X;
1013
1042
  if (typeof t === "function") t = t(r);
1014
- const s = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1043
+ const s = !e.ke || !e.ke(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1015
1044
  if (!s) {
1016
1045
  if (n && i && e.L) {
1017
1046
  insertSubs(e, true);
@@ -1035,8 +1064,8 @@ function setSignal(e, t) {
1035
1064
  e.X = t;
1036
1065
  }
1037
1066
  updatePendingSignal(e);
1038
- if (e.Pe) {
1039
- setSignal(e.Pe, t);
1067
+ if (e.Ge) {
1068
+ setSignal(e.Ge, t);
1040
1069
  }
1041
1070
  e.Ee = clock;
1042
1071
  insertSubs(e, n);
@@ -1047,7 +1076,7 @@ function computePendingState(e) {
1047
1076
  const t = e;
1048
1077
  const n = e.V;
1049
1078
  if (n && e.X !== NOT_PENDING) {
1050
- return !n.Ae && !(n.Se & STATUS_PENDING);
1079
+ return !n.Ce && !(n.Se & STATUS_PENDING);
1051
1080
  }
1052
1081
  if (e.ee !== void 0 && e.ee !== NOT_PENDING) {
1053
1082
  if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
@@ -1082,7 +1111,7 @@ function updatePendingSignal(e) {
1082
1111
  }
1083
1112
  }
1084
1113
  function isWrappable(e) {
1085
- return e != null && typeof e === "object" && !Object.isFrozen(e);
1114
+ return e != null && typeof e === "object" && !Object.isFrozen(e) && !(typeof Node !== "undefined" && e instanceof Node);
1086
1115
  }
1087
1116
  var DELETE = /* @__PURE__ */ Symbol(0);
1088
1117
  function updatePath(e, t, n = 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-query-persist-client",
3
- "version": "6.0.0-alpha.2",
3
+ "version": "6.0.0-beta.3",
4
4
  "description": "Solid.js bindings to work with persisters in TanStack/solid-query",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -55,15 +55,15 @@
55
55
  "@solidjs/web": "2.0.0-beta.4",
56
56
  "babel-preset-solid": "2.0.0-beta.4",
57
57
  "npm-run-all2": "^5.0.0",
58
- "solid-js": "2.0.0-beta.4",
58
+ "solid-js": "2.0.0-beta.5",
59
59
  "tsup-preset-solid": "^2.2.0",
60
- "vite-plugin-solid": "3.0.0-next.2",
60
+ "vite-plugin-solid": "3.0.0-next.4",
61
61
  "@tanstack/query-test-utils": "0.0.0",
62
- "@tanstack/solid-query": "6.0.0-alpha.2"
62
+ "@tanstack/solid-query": "6.0.0-beta.3"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "solid-js": ">=2.0.0-beta.0 <3.0.0",
66
- "@tanstack/solid-query": "^6.0.0-alpha.2"
66
+ "@tanstack/solid-query": "^6.0.0-beta.3"
67
67
  },
68
68
  "scripts": {
69
69
  "clean": "premove ./build ./coverage ./dist-ts",