@livestore/livestore 0.0.19 → 0.0.21

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.
Files changed (126) hide show
  1. package/README.md +18 -21
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/QueryCache.d.ts +1 -1
  4. package/dist/QueryCache.d.ts.map +1 -1
  5. package/dist/QueryCache.js.map +1 -1
  6. package/dist/__tests__/react/fixture.d.ts +5 -4
  7. package/dist/__tests__/react/fixture.d.ts.map +1 -1
  8. package/dist/__tests__/react/fixture.js +5 -5
  9. package/dist/__tests__/react/fixture.js.map +1 -1
  10. package/dist/__tests__/react/useComponentState.test.d.ts +2 -0
  11. package/dist/__tests__/react/useComponentState.test.d.ts.map +1 -0
  12. package/dist/__tests__/react/useComponentState.test.js +68 -0
  13. package/dist/__tests__/react/useComponentState.test.js.map +1 -0
  14. package/dist/__tests__/react/useLQuery.test.d.ts +2 -0
  15. package/dist/__tests__/react/useLQuery.test.d.ts.map +1 -0
  16. package/dist/__tests__/react/useLQuery.test.js +38 -0
  17. package/dist/__tests__/react/useLQuery.test.js.map +1 -0
  18. package/dist/__tests__/react/useLiveStoreComponent.test.js +4 -9
  19. package/dist/__tests__/react/useLiveStoreComponent.test.js.map +1 -1
  20. package/dist/__tests__/react/useQuery.test.d.ts +2 -0
  21. package/dist/__tests__/react/useQuery.test.d.ts.map +1 -0
  22. package/dist/__tests__/react/useQuery.test.js +33 -0
  23. package/dist/__tests__/react/useQuery.test.js.map +1 -0
  24. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.d.ts +2 -0
  25. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.d.ts.map +1 -0
  26. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.js +38 -0
  27. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.js.map +1 -0
  28. package/dist/__tests__/reactive.test.js +167 -93
  29. package/dist/__tests__/reactive.test.js.map +1 -1
  30. package/dist/__tests__/reactiveQueries/sql.test.d.ts +2 -0
  31. package/dist/__tests__/reactiveQueries/sql.test.d.ts.map +1 -0
  32. package/dist/__tests__/reactiveQueries/sql.test.js +337 -0
  33. package/dist/__tests__/reactiveQueries/sql.test.js.map +1 -0
  34. package/dist/inMemoryDatabase.d.ts +2 -2
  35. package/dist/inMemoryDatabase.d.ts.map +1 -1
  36. package/dist/index.d.ts +7 -5
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +4 -0
  39. package/dist/index.js.map +1 -1
  40. package/dist/react/index.d.ts +3 -3
  41. package/dist/react/index.d.ts.map +1 -1
  42. package/dist/react/index.js +2 -2
  43. package/dist/react/index.js.map +1 -1
  44. package/dist/react/useComponentState.d.ts +50 -0
  45. package/dist/react/useComponentState.d.ts.map +1 -0
  46. package/dist/react/useComponentState.js +248 -0
  47. package/dist/react/useComponentState.js.map +1 -0
  48. package/dist/react/useGlobalQuery.d.ts +3 -0
  49. package/dist/react/useGlobalQuery.d.ts.map +1 -0
  50. package/dist/react/useGlobalQuery.js +26 -0
  51. package/dist/react/useGlobalQuery.js.map +1 -0
  52. package/dist/react/useGraphQL.d.ts +3 -3
  53. package/dist/react/useGraphQL.d.ts.map +1 -1
  54. package/dist/react/useGraphQL.js +10 -8
  55. package/dist/react/useGraphQL.js.map +1 -1
  56. package/dist/react/useLiveStoreComponent.d.ts +6 -6
  57. package/dist/react/useLiveStoreComponent.d.ts.map +1 -1
  58. package/dist/react/useLiveStoreComponent.js +143 -99
  59. package/dist/react/useLiveStoreComponent.js.map +1 -1
  60. package/dist/react/useQuery.d.ts +2 -2
  61. package/dist/react/useQuery.d.ts.map +1 -1
  62. package/dist/react/useQuery.js +26 -22
  63. package/dist/react/useQuery.js.map +1 -1
  64. package/dist/react/useTemporaryQuery.d.ts +8 -0
  65. package/dist/react/useTemporaryQuery.d.ts.map +1 -0
  66. package/dist/react/useTemporaryQuery.js +17 -0
  67. package/dist/react/useTemporaryQuery.js.map +1 -0
  68. package/dist/react/utils/extractNamesFromStackTrace.d.ts +3 -0
  69. package/dist/react/utils/extractNamesFromStackTrace.d.ts.map +1 -0
  70. package/dist/react/utils/extractNamesFromStackTrace.js +40 -0
  71. package/dist/react/utils/extractNamesFromStackTrace.js.map +1 -0
  72. package/dist/react/utils/extractStackInfoFromStackTrace.d.ts +7 -0
  73. package/dist/react/utils/extractStackInfoFromStackTrace.d.ts.map +1 -0
  74. package/dist/react/utils/extractStackInfoFromStackTrace.js +40 -0
  75. package/dist/react/utils/extractStackInfoFromStackTrace.js.map +1 -0
  76. package/dist/reactive.d.ts +42 -48
  77. package/dist/reactive.d.ts.map +1 -1
  78. package/dist/reactive.js +293 -186
  79. package/dist/reactive.js.map +1 -1
  80. package/dist/reactiveQueries/base-class.d.ts +28 -23
  81. package/dist/reactiveQueries/base-class.d.ts.map +1 -1
  82. package/dist/reactiveQueries/base-class.js +25 -18
  83. package/dist/reactiveQueries/base-class.js.map +1 -1
  84. package/dist/reactiveQueries/graph.d.ts +10 -0
  85. package/dist/reactiveQueries/graph.d.ts.map +1 -0
  86. package/dist/reactiveQueries/graph.js +6 -0
  87. package/dist/reactiveQueries/graph.js.map +1 -0
  88. package/dist/reactiveQueries/graphql.d.ts +34 -17
  89. package/dist/reactiveQueries/graphql.d.ts.map +1 -1
  90. package/dist/reactiveQueries/graphql.js +91 -10
  91. package/dist/reactiveQueries/graphql.js.map +1 -1
  92. package/dist/reactiveQueries/js.d.ts +16 -12
  93. package/dist/reactiveQueries/js.d.ts.map +1 -1
  94. package/dist/reactiveQueries/js.js +31 -8
  95. package/dist/reactiveQueries/js.js.map +1 -1
  96. package/dist/reactiveQueries/sql.d.ts +22 -18
  97. package/dist/reactiveQueries/sql.d.ts.map +1 -1
  98. package/dist/reactiveQueries/sql.js +82 -16
  99. package/dist/reactiveQueries/sql.js.map +1 -1
  100. package/dist/store.d.ts +12 -52
  101. package/dist/store.d.ts.map +1 -1
  102. package/dist/store.js +283 -264
  103. package/dist/store.js.map +1 -1
  104. package/package.json +4 -3
  105. package/src/QueryCache.ts +1 -1
  106. package/src/__tests__/react/fixture.tsx +12 -7
  107. package/src/__tests__/react/{useLiveStoreComponent.test.tsx → useComponentState.test.tsx} +9 -20
  108. package/src/__tests__/react/useQuery.test.tsx +48 -0
  109. package/src/__tests__/react/utils/extractStackInfoFromStackTrace.test.ts +40 -0
  110. package/src/__tests__/reactive.test.ts +193 -140
  111. package/src/__tests__/reactiveQueries/sql.test.ts +372 -0
  112. package/src/inMemoryDatabase.ts +2 -2
  113. package/src/index.ts +7 -11
  114. package/src/react/index.ts +3 -7
  115. package/src/react/{useLiveStoreComponent.ts → useComponentState.ts} +89 -247
  116. package/src/react/useQuery.ts +29 -27
  117. package/src/react/useTemporaryQuery.ts +21 -0
  118. package/src/react/utils/extractStackInfoFromStackTrace.ts +47 -0
  119. package/src/reactive.ts +385 -268
  120. package/src/reactiveQueries/base-class.ts +60 -44
  121. package/src/reactiveQueries/graph.ts +15 -0
  122. package/src/reactiveQueries/graphql.ts +145 -29
  123. package/src/reactiveQueries/js.ts +53 -20
  124. package/src/reactiveQueries/sql.ts +129 -36
  125. package/src/store.ts +338 -408
  126. package/src/react/useGraphQL.ts +0 -138
package/dist/reactive.js CHANGED
@@ -1,47 +1,40 @@
1
1
  // This is a simple implementation of a reactive dependency graph.
2
- import { pick } from '@livestore/utils';
2
+ import { pick, shouldNeverHappen } from '@livestore/utils';
3
3
  import { isEqual, max, uniqueId } from 'lodash-es';
4
4
  import { BoundArray } from './bounded-collections.js';
5
- const NOT_REFRESHED_YET = Symbol.for('NOT_REFRESHED_YET');
6
- class DependencyNotReadyError extends Error {
7
- constructor(message) {
8
- super(message);
9
- this.name = 'DependencyNotReadyError';
10
- }
11
- }
5
+ // import { getDurationMsFromSpan } from './otel.js'
6
+ export const NOT_REFRESHED_YET = Symbol.for('NOT_REFRESHED_YET');
12
7
  export const unknownRefreshReason = () => {
13
- debugger;
8
+ // debugger
14
9
  return { _tag: 'unknown' };
15
10
  };
16
11
  const uniqueNodeId = () => uniqueId('node-');
17
12
  const uniqueRefreshInfoId = () => uniqueId('refresh-info-');
18
13
  const serializeAtom = (atom) => ({
19
- ...pick(atom, ['_tag', 'height', 'id', 'label', 'meta', 'result']),
14
+ ...pick(atom, ['_tag', 'height', 'id', 'label', 'meta']),
20
15
  sub: Array.from(atom.sub).map((a) => a.id),
21
16
  super: Array.from(atom.super).map((a) => a.id),
22
17
  });
23
- const serializeEffect = (effect) => pick(effect, ['_tag', 'id']);
18
+ // const serializeEffect = (effect: Effect): SerializedEffect => pick(effect, ['_tag', 'id'])
24
19
  export class ReactiveGraph {
25
20
  constructor(options) {
26
21
  this.atoms = new Set();
27
- this.effects = new Set();
28
- this.dirtyNodes = new Set();
29
22
  this.debugRefreshInfos = new BoundArray(5000);
30
23
  this.getSnapshot = () => ({
31
24
  atoms: Array.from(this.atoms).map(serializeAtom),
32
- effects: Array.from(this.effects).map(serializeEffect),
33
- dirtyNodes: Array.from(this.dirtyNodes).map((a) => a.id),
25
+ // effects: Array.from(this.effects).map(serializeEffect),
26
+ // dirtyNodes: Array.from(this.dirtyNodes).map((a) => a.id),
34
27
  });
35
28
  this.effectsWrapper = options?.effectsWrapper ?? ((runEffects) => runEffects());
36
- this.otelTracer = options.otelTracer;
37
29
  }
38
30
  makeRef(val, options) {
39
31
  const ref = {
40
32
  _tag: 'ref',
41
33
  id: uniqueNodeId(),
42
- result: val,
34
+ isDirty: false,
35
+ previousResult: val,
43
36
  height: 0,
44
- getResult: () => ref.result,
37
+ computeResult: () => ref.previousResult,
45
38
  sub: new Set(),
46
39
  super: new Set(),
47
40
  label: options?.label,
@@ -51,26 +44,80 @@ export class ReactiveGraph {
51
44
  this.atoms.add(ref);
52
45
  return ref;
53
46
  }
54
- makeThunk(getResult, options, otelContext) {
47
+ makeThunk(getResult_, options) {
48
+ // const computeResult = (): T => {
49
+ // const getAtom = (atom: Atom<T, any>): T => {
50
+ // const __getResult = atom._tag === 'thunk' ? atom.__getResult.toString() : ''
51
+ // if (atom.isDirty) {
52
+ // console.log('atom is dirty', atom.id, atom.label ?? '', atom._tag, __getResult)
53
+ // const result = atom.computeResult()
54
+ // atom.isDirty = false
55
+ // atom.previousResult = result
56
+ // return result
57
+ // } else {
58
+ // console.log('atom is clean', atom.id, atom.label ?? '', atom._tag, __getResult)
59
+ // return atom.previousResult as T
60
+ // }
61
+ // }
62
+ // let resultChanged = false
63
+ // const debugInfoForAtom = {
64
+ // atom: serializeAtom(null as TODO),
65
+ // resultChanged,
66
+ // // debugInfo: unknownRefreshReason() as TDebugThunkInfo,
67
+ // debugInfo: { _tag: 'unknown' } as TDebugThunkInfo,
68
+ // durationMs: 0,
69
+ // } satisfies AtomDebugInfo<TDebugThunkInfo>
70
+ const addDebugInfo = (_debugInfo) => {
71
+ // debugInfoForAtom.debugInfo = debugInfo
72
+ };
73
+ // debugInfoForRefreshedAtoms.push(debugInfoForAtom)
74
+ // return getResult_(getAtom as GetAtom, addDebugInfo, this.context!)
75
+ // }
55
76
  const thunk = {
56
77
  _tag: 'thunk',
57
78
  id: uniqueNodeId(),
58
- result: NOT_REFRESHED_YET,
79
+ previousResult: NOT_REFRESHED_YET,
80
+ isDirty: true,
59
81
  height: 0,
60
- getResult,
82
+ computeResult: (otelContext) => {
83
+ if (thunk.isDirty) {
84
+ // Reset previous subcomputations as we're about to re-add them as part of the `doEffect` call below
85
+ thunk.sub = new Set();
86
+ const compute_ = (atom, otelContext) => {
87
+ this.addEdge(thunk, atom);
88
+ return compute(atom, otelContext);
89
+ };
90
+ const result = getResult_(compute_, addDebugInfo, this.context ?? shouldNeverHappen('No store context set yet'), otelContext);
91
+ thunk.isDirty = false;
92
+ thunk.previousResult = result;
93
+ thunk.recomputations++;
94
+ return result;
95
+ }
96
+ else {
97
+ return thunk.previousResult;
98
+ }
99
+ },
61
100
  sub: new Set(),
62
101
  super: new Set(),
102
+ recomputations: 0,
63
103
  label: options?.label,
64
104
  meta: options?.meta,
65
105
  equal: options?.equal ?? isEqual,
106
+ __getResult: getResult_,
66
107
  };
67
108
  this.atoms.add(thunk);
68
- this.dirtyNodes.add(thunk);
69
- this.refresh({
70
- otelHint: options?.label ?? 'makeThunk',
71
- debugRefreshReason: options?.debugRefreshReason ?? { _tag: 'makeThunk', label: options?.label },
72
- }, otelContext);
73
- // Manually tell the typesystem this thunk is guaranteed to have a result at this point
109
+ // this.dirtyNodes.add(thunk)
110
+ const debugRefreshReason = options?.debugRefreshReason ?? { _tag: 'makeThunk', label: options?.label };
111
+ const refreshDebugInfo = {
112
+ id: uniqueRefreshInfoId(),
113
+ reason: debugRefreshReason,
114
+ skippedRefresh: true,
115
+ refreshedAtoms: [],
116
+ durationMs: 0,
117
+ completedTimestamp: Date.now(),
118
+ graphSnapshot: this.getSnapshot(),
119
+ };
120
+ this.debugRefreshInfos.push(refreshDebugInfo);
74
121
  return thunk;
75
122
  }
76
123
  destroy(node) {
@@ -84,78 +131,97 @@ export class ReactiveGraph {
84
131
  for (const subComp of node.sub) {
85
132
  this.removeEdge(node, subComp);
86
133
  }
87
- if (node._tag === 'effect') {
88
- this.effects.delete(node);
89
- }
90
- else {
134
+ if (node._tag !== 'effect') {
91
135
  this.atoms.delete(node);
92
136
  }
93
137
  }
94
- makeEffect(doEffect, options, otelContext) {
138
+ makeEffect(doEffect, options) {
95
139
  const effect = {
96
140
  _tag: 'effect',
97
141
  id: uniqueNodeId(),
98
- doEffect,
142
+ doEffect: (otelContext) => {
143
+ // Reset previous subcomputations as we're about to re-add them as part of the `doEffect` call below
144
+ effect.sub = new Set();
145
+ const getAtom = (atom, otelContext) => {
146
+ this.addEdge(effect, atom);
147
+ return compute(atom, otelContext);
148
+ };
149
+ doEffect(getAtom, otelContext);
150
+ },
99
151
  sub: new Set(),
100
152
  };
101
- this.effects.add(effect);
102
- this.dirtyNodes.add(effect);
103
- this.refresh({ otelHint: 'makeEffect', debugRefreshReason: { _tag: 'makeEffect', label: options?.label } }, otelContext);
153
+ // this.effects.add(effect)
154
+ // this.dirtyNodes.add(effect)
155
+ const debugRefreshReason = options?.debugRefreshReason ?? { _tag: 'makeEffect', label: options?.label };
156
+ const refreshDebugInfo = {
157
+ id: uniqueRefreshInfoId(),
158
+ reason: debugRefreshReason ?? unknownRefreshReason(),
159
+ skippedRefresh: true,
160
+ refreshedAtoms: [],
161
+ durationMs: 0,
162
+ completedTimestamp: Date.now(),
163
+ graphSnapshot: this.getSnapshot(),
164
+ };
165
+ this.debugRefreshInfos.push(refreshDebugInfo);
104
166
  return effect;
105
167
  }
106
- setRef(ref, val, options, otelContext) {
107
- const { otelHint, skipRefresh, debugRefreshReason } = options ?? {};
108
- ref.result = val;
109
- this.dirtyNodes.add(ref);
110
- if (skipRefresh) {
111
- const refreshDebugInfo = {
112
- id: uniqueRefreshInfoId(),
113
- reason: debugRefreshReason ?? unknownRefreshReason(),
114
- skippedRefresh: true,
115
- refreshedAtoms: [],
116
- durationMs: 0,
117
- completedTimestamp: Date.now(),
118
- graphSnapshot: this.getSnapshot(),
119
- };
120
- this.debugRefreshInfos.push(refreshDebugInfo);
121
- return;
122
- }
123
- this.refresh({ otelHint, debugRefreshReason }, otelContext);
168
+ setRef(ref, val, options) {
169
+ const { debugRefreshReason } = options ?? {};
170
+ ref.previousResult = val;
171
+ const effectsToRefresh = new Set();
172
+ markSuperCompDirtyRec(ref, effectsToRefresh);
173
+ this.effectsWrapper(() => {
174
+ for (const effect of effectsToRefresh) {
175
+ effect.doEffect(options?.otelContext);
176
+ }
177
+ });
178
+ const refreshDebugInfo = {
179
+ id: uniqueRefreshInfoId(),
180
+ reason: debugRefreshReason ?? unknownRefreshReason(),
181
+ skippedRefresh: true,
182
+ refreshedAtoms: [],
183
+ durationMs: 0,
184
+ completedTimestamp: Date.now(),
185
+ graphSnapshot: this.getSnapshot(),
186
+ };
187
+ this.debugRefreshInfos.push(refreshDebugInfo);
124
188
  }
125
- setRefs(refs, options, otelContext) {
126
- const otelHint = options?.otelHint ?? '';
127
- const skipRefresh = options?.skipRefresh ?? false;
189
+ setRefs(refs, options) {
128
190
  const debugRefreshReason = options?.debugRefreshReason;
191
+ const effectsToRefresh = new Set();
129
192
  for (const [ref, val] of refs) {
130
- ref.result = val;
131
- this.dirtyNodes.add(ref);
132
- }
133
- if (skipRefresh) {
134
- const refreshDebugInfo = {
135
- id: uniqueRefreshInfoId(),
136
- reason: debugRefreshReason ?? unknownRefreshReason(),
137
- skippedRefresh: true,
138
- refreshedAtoms: [],
139
- durationMs: 0,
140
- completedTimestamp: Date.now(),
141
- graphSnapshot: this.getSnapshot(),
142
- };
143
- this.debugRefreshInfos.push(refreshDebugInfo);
144
- return;
193
+ ref.previousResult = val;
194
+ markSuperCompDirtyRec(ref, effectsToRefresh);
145
195
  }
146
- this.refresh({ otelHint, debugRefreshReason }, otelContext);
147
- }
148
- get(atom, context) {
149
- // Autotracking: if we're getting the value of an atom,
150
- // that means it's a subcomputation for the currently refreshing atom.
151
- this.addEdge(context, atom);
152
- const dependencyMightBeStale = context._tag !== 'effect' && context.height <= atom.height;
153
- const dependencyNotRefreshedYet = atom.result === NOT_REFRESHED_YET;
154
- if (dependencyMightBeStale || dependencyNotRefreshedYet) {
155
- throw new DependencyNotReadyError(`${this.label(context)} referenced dependency ${this.label(atom)} which isn't ready`);
156
- }
157
- return atom.result;
196
+ this.effectsWrapper(() => {
197
+ for (const effect of effectsToRefresh) {
198
+ effect.doEffect(options?.otelContext);
199
+ }
200
+ });
201
+ const refreshDebugInfo = {
202
+ id: uniqueRefreshInfoId(),
203
+ reason: debugRefreshReason ?? unknownRefreshReason(),
204
+ skippedRefresh: true,
205
+ refreshedAtoms: [],
206
+ durationMs: 0,
207
+ completedTimestamp: Date.now(),
208
+ graphSnapshot: this.getSnapshot(),
209
+ };
210
+ this.debugRefreshInfos.push(refreshDebugInfo);
158
211
  }
212
+ // get<T>(atom: Atom<T, TContext>, context: Atom<any, TContext> | Effect): T {
213
+ // // Autotracking: if we're getting the value of an atom,
214
+ // // that means it's a subcomputation for the currently refreshing atom.
215
+ // this.addEdge(context, atom)
216
+ // const dependencyMightBeStale = context._tag !== 'effect' && context.height <= atom.height
217
+ // const dependencyNotRefreshedYet = atom.result === NOT_REFRESHED_YET
218
+ // if (dependencyMightBeStale || dependencyNotRefreshedYet) {
219
+ // throw new DependencyNotReadyError(
220
+ // `${this.label(context)} referenced dependency ${this.label(atom)} which isn't ready`,
221
+ // )
222
+ // }
223
+ // return atom.result
224
+ // }
159
225
  /**
160
226
  * Update the graph to be consistent with the current values of the root atoms.
161
227
  * Generally we run this after a ref is updated.
@@ -163,106 +229,118 @@ export class ReactiveGraph {
163
229
  *
164
230
  * @param roots Root atoms to start the refresh from
165
231
  */
166
- refresh(options, otelContext) {
167
- const otelHint = options?.otelHint ?? '';
168
- const debugRefreshReason = options?.debugRefreshReason;
169
- const roots = [...this.dirtyNodes];
170
- const debugInfoForRefreshedAtoms = [];
171
- // if (otelHint.includes('tableName')) {
172
- // console.log('refresh', otelHint, { shouldTrace })
173
- // }
174
- this.otelTracer.startActiveSpan(`LiveStore.refresh:${otelHint}`, {}, otelContext, (span) => {
175
- const atomsToRefresh = roots.filter(isAtom);
176
- const effectsToRun = new Set(roots.filter(isEffect));
177
- span.setAttribute('livestore.hint', otelHint);
178
- span.setAttribute('livestore.rootsCount', roots.length);
179
- // span.setAttribute('sstack', new Error().stack!)
180
- // Sort in topological order, starting with minimum height
181
- while (atomsToRefresh.length > 0) {
182
- atomsToRefresh.sort((a, b) => a.height - b.height);
183
- const atomToRefresh = atomsToRefresh.shift();
184
- // Recompute the value
185
- let resultChanged = false;
186
- const debugInfoForAtom = {
187
- atom: serializeAtom(atomToRefresh),
188
- resultChanged,
189
- // debugInfo: unknownRefreshReason() as TDebugThunkInfo,
190
- debugInfo: { _tag: 'unknown' },
191
- durationMs: 0,
192
- };
193
- try {
194
- atomToRefresh.sub = new Set();
195
- const beforeTimestamp = performance.now();
196
- const newResult = atomToRefresh.getResult((atom) => this.get(atom, atomToRefresh), (debugInfo) => {
197
- debugInfoForAtom.debugInfo = debugInfo;
198
- });
199
- const afterTimestamp = performance.now();
200
- debugInfoForAtom.durationMs = afterTimestamp - beforeTimestamp;
201
- // Determine if the result changed to do early cutoff and avoid further unnecessary updates.
202
- // Refs never depend on anything, so if a ref is being refreshed it definitely changed.
203
- // For thunks, we use a deep equality check.
204
- resultChanged =
205
- atomToRefresh._tag === 'ref' ||
206
- (atomToRefresh._tag === 'thunk' && !atomToRefresh.equal(atomToRefresh.result, newResult));
207
- if (resultChanged) {
208
- atomToRefresh.result = newResult;
209
- }
210
- this.dirtyNodes.delete(atomToRefresh);
211
- }
212
- catch (e) {
213
- if (e instanceof DependencyNotReadyError) {
214
- // If we hit a dependency that wasn't ready yet,
215
- // abort this recomputation and try again later.
216
- if (!atomsToRefresh.includes(atomToRefresh)) {
217
- atomsToRefresh.push(atomToRefresh);
218
- }
219
- }
220
- else {
221
- throw e;
222
- }
223
- }
224
- debugInfoForRefreshedAtoms.push(debugInfoForAtom);
225
- if (!resultChanged) {
226
- continue;
227
- }
228
- // Schedule supercomputations
229
- for (const superComp of atomToRefresh.super) {
230
- switch (superComp._tag) {
231
- case 'ref':
232
- case 'thunk': {
233
- if (!atomsToRefresh.includes(superComp)) {
234
- atomsToRefresh.push(superComp);
235
- }
236
- break;
237
- }
238
- case 'effect': {
239
- effectsToRun.add(superComp);
240
- break;
241
- }
242
- }
243
- }
244
- }
245
- this.effectsWrapper(() => {
246
- for (const effect of effectsToRun) {
247
- effect.doEffect((atom) => this.get(atom, effect));
248
- this.dirtyNodes.delete(effect);
249
- }
250
- });
251
- span.end();
252
- const spanDurationHr = span._duration;
253
- const spanDurationMs = spanDurationHr[0] * 1000 + spanDurationHr[1] / 1000000;
254
- const refreshDebugInfo = {
255
- id: uniqueRefreshInfoId(),
256
- reason: debugRefreshReason ?? unknownRefreshReason(),
257
- refreshedAtoms: debugInfoForRefreshedAtoms,
258
- skippedRefresh: false,
259
- durationMs: spanDurationMs,
260
- completedTimestamp: Date.now(),
261
- graphSnapshot: this.getSnapshot(),
262
- };
263
- this.debugRefreshInfos.push(refreshDebugInfo);
264
- });
265
- }
232
+ // refresh(
233
+ // options?:
234
+ // | {
235
+ // otelHint?: string
236
+ // debugRefreshReason?: RefreshReasonWithGenericReasons<TDebugRefreshReason>
237
+ // }
238
+ // | undefined,
239
+ // otelContext: otel.Context = otel.context.active(),
240
+ // ): void {
241
+ // const otelHint = options?.otelHint ?? ''
242
+ // const debugRefreshReason = options?.debugRefreshReason
243
+ // const roots = [...this.dirtyNodes]
244
+ // const debugInfoForRefreshedAtoms: AtomDebugInfo<TDebugThunkInfo>[] = []
245
+ // // if (otelHint.includes('tableName')) {
246
+ // // console.log('refresh', otelHint, { shouldTrace })
247
+ // // }
248
+ // this.otelTracer.startActiveSpan(`LiveStore.refresh:${otelHint}`, {}, otelContext, (span) => {
249
+ // const atomsToRefresh = roots.filter(isAtom)
250
+ // const effectsToRun = new Set(roots.filter(isEffect))
251
+ // span.setAttribute('livestore.hint', otelHint)
252
+ // span.setAttribute('livestore.rootsCount', roots.length)
253
+ // // span.setAttribute('sstack', new Error().stack!)
254
+ // // Sort in topological order, starting with minimum height
255
+ // while (atomsToRefresh.length > 0) {
256
+ // atomsToRefresh.sort((a, b) => a.height - b.height)
257
+ // const atomToRefresh = atomsToRefresh.shift()!
258
+ // // Recompute the value
259
+ // let resultChanged = false
260
+ // const debugInfoForAtom = {
261
+ // atom: serializeAtom(atomToRefresh),
262
+ // resultChanged,
263
+ // // debugInfo: unknownRefreshReason() as TDebugThunkInfo,
264
+ // debugInfo: { _tag: 'unknown' } as TDebugThunkInfo,
265
+ // durationMs: 0,
266
+ // } satisfies AtomDebugInfo<TDebugThunkInfo>
267
+ // try {
268
+ // atomToRefresh.sub = new Set()
269
+ // const beforeTimestamp = performance.now()
270
+ // const newResult = atomToRefresh.getResult(
271
+ // (atom) => this.get(atom, atomToRefresh),
272
+ // (debugInfo) => {
273
+ // debugInfoForAtom.debugInfo = debugInfo
274
+ // },
275
+ // this.context ?? shouldNeverHappen(`No context provided yet for ReactiveGraph`),
276
+ // )
277
+ // const afterTimestamp = performance.now()
278
+ // debugInfoForAtom.durationMs = afterTimestamp - beforeTimestamp
279
+ // // Determine if the result changed to do early cutoff and avoid further unnecessary updates.
280
+ // // Refs never depend on anything, so if a ref is being refreshed it definitely changed.
281
+ // // For thunks, we use a deep equality check.
282
+ // resultChanged =
283
+ // atomToRefresh._tag === 'ref' ||
284
+ // (atomToRefresh._tag === 'thunk' && !atomToRefresh.equal(atomToRefresh.result, newResult))
285
+ // if (resultChanged) {
286
+ // atomToRefresh.result = newResult
287
+ // }
288
+ // this.dirtyNodes.delete(atomToRefresh)
289
+ // } catch (e) {
290
+ // if (e instanceof DependencyNotReadyError) {
291
+ // // If we hit a dependency that wasn't ready yet,
292
+ // // abort this recomputation and try again later.
293
+ // if (!atomsToRefresh.includes(atomToRefresh)) {
294
+ // atomsToRefresh.push(atomToRefresh)
295
+ // }
296
+ // } else {
297
+ // throw e
298
+ // }
299
+ // }
300
+ // debugInfoForRefreshedAtoms.push(debugInfoForAtom)
301
+ // if (!resultChanged) {
302
+ // continue
303
+ // }
304
+ // // Schedule supercomputations
305
+ // for (const superComp of atomToRefresh.super) {
306
+ // switch (superComp._tag) {
307
+ // case 'ref':
308
+ // case 'thunk': {
309
+ // if (!atomsToRefresh.includes(superComp)) {
310
+ // atomsToRefresh.push(superComp)
311
+ // }
312
+ // break
313
+ // }
314
+ // case 'effect': {
315
+ // effectsToRun.add(superComp)
316
+ // break
317
+ // }
318
+ // }
319
+ // }
320
+ // }
321
+ // this.effectsWrapper(() => {
322
+ // for (const effect of effectsToRun) {
323
+ // effect.doEffect((atom: Atom<any, TContext>) => this.get(atom, effect))
324
+ // this.dirtyNodes.delete(effect)
325
+ // }
326
+ // })
327
+ // span.end()
328
+ // const spanDurationMs = getDurationMsFromSpan(span)
329
+ // const refreshDebugInfo: RefreshDebugInfo<
330
+ // RefreshReasonWithGenericReasons<TDebugRefreshReason>,
331
+ // TDebugThunkInfo
332
+ // > = {
333
+ // id: uniqueRefreshInfoId(),
334
+ // reason: debugRefreshReason ?? unknownRefreshReason(),
335
+ // refreshedAtoms: debugInfoForRefreshedAtoms,
336
+ // skippedRefresh: false,
337
+ // durationMs: spanDurationMs,
338
+ // completedTimestamp: Date.now(),
339
+ // graphSnapshot: this.getSnapshot(),
340
+ // }
341
+ // this.debugRefreshInfos.push(refreshDebugInfo)
342
+ // })
343
+ // }
266
344
  label(atom) {
267
345
  if (atom._tag === 'effect') {
268
346
  return `unknown effect`;
@@ -296,7 +374,36 @@ export class ReactiveGraph {
296
374
  }
297
375
  }
298
376
  }
377
+ get atomsCount() {
378
+ return this.atoms.size;
379
+ }
299
380
  }
300
- const isAtom = (a) => a._tag === 'ref' || a._tag === 'thunk';
301
- const isEffect = (a) => a._tag === 'effect';
381
+ // const isAtom = <T, TContext>(a: Atom<T, TContext> | Effect): a is Atom<T, TContext> =>
382
+ // a._tag === 'ref' || a._tag === 'thunk'
383
+ // const isEffect = <T, TContext>(a: Atom<T, TContext> | Effect): a is Effect => a._tag === 'effect'
384
+ const compute = (atom, otelContext) => {
385
+ // const __getResult = atom._tag === 'thunk' ? atom.__getResult.toString() : ''
386
+ if (atom.isDirty) {
387
+ // console.log('atom is dirty', atom.id, atom.label ?? '', atom._tag, __getResult)
388
+ const result = atom.computeResult(otelContext);
389
+ atom.isDirty = false;
390
+ atom.previousResult = result;
391
+ return result;
392
+ }
393
+ else {
394
+ // console.log('atom is clean', atom.id, atom.label ?? '', atom._tag, __getResult)
395
+ return atom.previousResult;
396
+ }
397
+ };
398
+ const markSuperCompDirtyRec = (atom, effectsToRefresh) => {
399
+ for (const superComp of atom.super) {
400
+ if (superComp._tag === 'thunk' || superComp._tag === 'ref') {
401
+ superComp.isDirty = true;
402
+ markSuperCompDirtyRec(superComp, effectsToRefresh);
403
+ }
404
+ else {
405
+ effectsToRefresh.add(superComp);
406
+ }
407
+ }
408
+ };
302
409
  //# sourceMappingURL=reactive.js.map
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