@livestore/react 0.3.0-dev.10 → 0.3.0-dev.11

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 (74) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/LiveStoreContext.d.ts +5 -3
  3. package/dist/LiveStoreContext.d.ts.map +1 -1
  4. package/dist/LiveStoreContext.js +7 -3
  5. package/dist/LiveStoreContext.js.map +1 -1
  6. package/dist/LiveStoreProvider.js +2 -17
  7. package/dist/LiveStoreProvider.js.map +1 -1
  8. package/dist/__tests__/fixture.d.ts +6 -8
  9. package/dist/__tests__/fixture.d.ts.map +1 -1
  10. package/dist/__tests__/fixture.js +6 -7
  11. package/dist/__tests__/fixture.js.map +1 -1
  12. package/dist/experimental/components/LiveList.d.ts +2 -2
  13. package/dist/experimental/components/LiveList.d.ts.map +1 -1
  14. package/dist/experimental/components/LiveList.js +5 -4
  15. package/dist/experimental/components/LiveList.js.map +1 -1
  16. package/dist/mod.d.ts +0 -1
  17. package/dist/mod.d.ts.map +1 -1
  18. package/dist/mod.js +0 -1
  19. package/dist/mod.js.map +1 -1
  20. package/dist/useAtom.d.ts +4 -2
  21. package/dist/useAtom.d.ts.map +1 -1
  22. package/dist/useAtom.js +32 -28
  23. package/dist/useAtom.js.map +1 -1
  24. package/dist/useQuery.d.ts +26 -3
  25. package/dist/useQuery.d.ts.map +1 -1
  26. package/dist/useQuery.js +60 -45
  27. package/dist/useQuery.js.map +1 -1
  28. package/dist/useQuery.test.js +70 -16
  29. package/dist/useQuery.test.js.map +1 -1
  30. package/dist/useRcRef.d.ts +72 -0
  31. package/dist/useRcRef.d.ts.map +1 -0
  32. package/dist/useRcRef.js +146 -0
  33. package/dist/useRcRef.js.map +1 -0
  34. package/dist/useRcRef.test.d.ts +2 -0
  35. package/dist/useRcRef.test.d.ts.map +1 -0
  36. package/dist/useRcRef.test.js +128 -0
  37. package/dist/useRcRef.test.js.map +1 -0
  38. package/dist/useRcResource.d.ts +76 -0
  39. package/dist/useRcResource.d.ts.map +1 -0
  40. package/dist/useRcResource.js +150 -0
  41. package/dist/useRcResource.js.map +1 -0
  42. package/dist/useRcResource.test.d.ts +2 -0
  43. package/dist/useRcResource.test.d.ts.map +1 -0
  44. package/dist/useRcResource.test.js +122 -0
  45. package/dist/useRcResource.test.js.map +1 -0
  46. package/dist/useRow.d.ts +10 -7
  47. package/dist/useRow.d.ts.map +1 -1
  48. package/dist/useRow.js +16 -19
  49. package/dist/useRow.js.map +1 -1
  50. package/dist/useRow.test.js +62 -80
  51. package/dist/useRow.test.js.map +1 -1
  52. package/dist/useScopedQuery.d.ts +10 -4
  53. package/dist/useScopedQuery.d.ts.map +1 -1
  54. package/dist/useScopedQuery.js +96 -52
  55. package/dist/useScopedQuery.js.map +1 -1
  56. package/dist/useScopedQuery.test.js +13 -12
  57. package/dist/useScopedQuery.test.js.map +1 -1
  58. package/package.json +6 -6
  59. package/src/LiveStoreContext.ts +10 -6
  60. package/src/LiveStoreProvider.tsx +1 -17
  61. package/src/__snapshots__/useQuery.test.tsx.snap +2011 -0
  62. package/src/__snapshots__/useRow.test.tsx.snap +335 -140
  63. package/src/__tests__/fixture.tsx +6 -9
  64. package/src/experimental/components/LiveList.tsx +8 -7
  65. package/src/mod.ts +0 -1
  66. package/src/useAtom.ts +22 -11
  67. package/src/useQuery.test.tsx +165 -67
  68. package/src/useQuery.ts +84 -54
  69. package/src/useRcResource.test.tsx +167 -0
  70. package/src/useRcResource.ts +180 -0
  71. package/src/useRow.test.tsx +73 -107
  72. package/src/useRow.ts +32 -35
  73. package/src/useScopedQuery.test.tsx +0 -96
  74. package/src/useScopedQuery.ts +0 -143
@@ -21,25 +21,6 @@ exports[`useRow > otel > should update the data based on component key strictMod
21
21
  ",
22
22
  },
23
23
  },
24
- {
25
- "_name": "LiveStore:createStore",
26
- },
27
- {
28
- "_name": "sql-in-memory-select",
29
- "attributes": {
30
- "sql.cached": false,
31
- "sql.query": "SELECT 1 FROM 'UserInfo' WHERE id = ?",
32
- "sql.rowsCount": 0,
33
- },
34
- },
35
- {
36
- "_name": "sql-in-memory-select",
37
- "attributes": {
38
- "sql.cached": false,
39
- "sql.query": "SELECT 1 FROM 'UserInfo' WHERE id = ?",
40
- "sql.rowsCount": 1,
41
- },
42
- },
43
24
  {
44
25
  "_name": "LiveStore:sync",
45
26
  },
@@ -49,22 +30,17 @@ exports[`useRow > otel > should update the data based on component key strictMod
49
30
  {
50
31
  "_name": "LiveStore:mutate",
51
32
  "attributes": {
52
- "livestore.mutateLabel": "mutate",
33
+ "livestore.mutationEventTags": [
34
+ "_Derived_Create_UserInfo",
35
+ ],
36
+ "livestore.mutationEventsCount": 1,
53
37
  },
54
38
  "children": [
55
39
  {
56
- "_name": "LiveStore:mutate:applyMutations",
40
+ "_name": "livestore.in-memory-db:execute",
57
41
  "attributes": {
58
- "livestore.mutateLabel": "mutate",
42
+ "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
59
43
  },
60
- "children": [
61
- {
62
- "_name": "livestore.in-memory-db:execute",
63
- "attributes": {
64
- "sql.query": "INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')",
65
- },
66
- },
67
- ],
68
44
  },
69
45
  ],
70
46
  },
@@ -74,60 +50,67 @@ exports[`useRow > otel > should update the data based on component key strictMod
74
50
  "_name": "LiveStore:queries",
75
51
  "children": [
76
52
  {
77
- "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
53
+ "_name": "LiveStore:useRow:UserInfo:u1",
78
54
  "attributes": {
79
- "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
80
- "sql.rowsCount": 1,
55
+ "firstStackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
56
+ "label": "SELECT * FROM 'UserInfo' WHERE id = ?",
81
57
  },
82
58
  "children": [
83
59
  {
84
60
  "_name": "sql-in-memory-select",
85
61
  "attributes": {
86
62
  "sql.cached": false,
87
- "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
88
- "sql.rowsCount": 1,
63
+ "sql.query": "SELECT 1 FROM 'UserInfo' WHERE id = ?",
64
+ "sql.rowsCount": 0,
89
65
  },
90
66
  },
91
- ],
92
- },
93
- {
94
- "_name": "LiveStore:useRow:UserInfo:u1",
95
- "attributes": {
96
- "id": "u1",
97
- },
98
- "children": [
99
67
  {
100
68
  "_name": "LiveStore:mutate",
101
69
  "attributes": {
102
- "livestore.mutateLabel": "mutate",
70
+ "livestore.mutateLabel": "rowQuery:UserInfo:u1",
71
+ "livestore.mutationEventTags": [
72
+ "_Derived_Create_UserInfo",
73
+ ],
74
+ "livestore.mutationEventsCount": 1,
103
75
  },
104
76
  "children": [
105
77
  {
106
- "_name": "LiveStore:mutate:applyMutations",
78
+ "_name": "livestore.in-memory-db:execute",
107
79
  "attributes": {
108
- "livestore.mutateLabel": "mutate",
80
+ "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
81
+ },
82
+ },
83
+ ],
84
+ },
85
+ {
86
+ "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
87
+ "attributes": {
88
+ "livestore.debugRefreshReason": "useQuery:initial-run:row:UserInfo:u1",
89
+ "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
90
+ "sql.rowsCount": 1,
91
+ },
92
+ "children": [
93
+ {
94
+ "_name": "sql-in-memory-select",
95
+ "attributes": {
96
+ "sql.cached": false,
97
+ "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
98
+ "sql.rowsCount": 1,
109
99
  },
110
- "children": [
111
- {
112
- "_name": "livestore.in-memory-db:execute",
113
- "attributes": {
114
- "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
115
- },
116
- },
117
- ],
118
100
  },
119
101
  ],
120
102
  },
121
103
  {
122
- "_name": "LiveStore:useQuery:db(row:UserInfo:u1)",
104
+ "_name": "LiveStore.subscribe",
123
105
  "attributes": {
124
- "label": "db(row:UserInfo:u1)",
125
- "stackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
106
+ "label": "row:UserInfo:u1",
107
+ "queryLabel": "row:UserInfo:u1",
126
108
  },
127
109
  "children": [
128
110
  {
129
111
  "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
130
112
  "attributes": {
113
+ "livestore.debugRefreshReason": "mutate",
131
114
  "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
132
115
  "sql.rowsCount": 1,
133
116
  },
@@ -142,13 +125,6 @@ exports[`useRow > otel > should update the data based on component key strictMod
142
125
  },
143
126
  ],
144
127
  },
145
- {
146
- "_name": "LiveStore.subscribe",
147
- "attributes": {
148
- "label": "db(row:UserInfo:u1)",
149
- "queryLabel": "db(row:UserInfo:u1)",
150
- },
151
- },
152
128
  ],
153
129
  },
154
130
  ],
@@ -156,19 +132,47 @@ exports[`useRow > otel > should update the data based on component key strictMod
156
132
  {
157
133
  "_name": "LiveStore:useRow:UserInfo:u2",
158
134
  "attributes": {
159
- "id": "u2",
135
+ "firstStackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
136
+ "label": "SELECT * FROM 'UserInfo' WHERE id = ?",
160
137
  },
161
138
  "children": [
162
139
  {
163
- "_name": "LiveStore:useQuery:db(row:UserInfo:u2)",
140
+ "_name": "sql-in-memory-select",
141
+ "attributes": {
142
+ "sql.cached": false,
143
+ "sql.query": "SELECT 1 FROM 'UserInfo' WHERE id = ?",
144
+ "sql.rowsCount": 1,
145
+ },
146
+ },
147
+ {
148
+ "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
149
+ "attributes": {
150
+ "livestore.debugRefreshReason": "useQuery:initial-run:row:UserInfo:u2",
151
+ "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
152
+ "sql.rowsCount": 1,
153
+ },
154
+ "children": [
155
+ {
156
+ "_name": "sql-in-memory-select",
157
+ "attributes": {
158
+ "sql.cached": false,
159
+ "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
160
+ "sql.rowsCount": 1,
161
+ },
162
+ },
163
+ ],
164
+ },
165
+ {
166
+ "_name": "LiveStore.subscribe",
164
167
  "attributes": {
165
- "label": "db(row:UserInfo:u2)",
166
- "stackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
168
+ "label": "row:UserInfo:u2",
169
+ "queryLabel": "row:UserInfo:u2",
167
170
  },
168
171
  "children": [
169
172
  {
170
173
  "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
171
174
  "attributes": {
175
+ "livestore.debugRefreshReason": "subscribe-initial-run:row:UserInfo:u2",
172
176
  "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
173
177
  "sql.rowsCount": 1,
174
178
  },
@@ -176,20 +180,13 @@ exports[`useRow > otel > should update the data based on component key strictMod
176
180
  {
177
181
  "_name": "sql-in-memory-select",
178
182
  "attributes": {
179
- "sql.cached": false,
183
+ "sql.cached": true,
180
184
  "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
181
185
  "sql.rowsCount": 1,
182
186
  },
183
187
  },
184
188
  ],
185
189
  },
186
- {
187
- "_name": "LiveStore.subscribe",
188
- "attributes": {
189
- "label": "db(row:UserInfo:u2)",
190
- "queryLabel": "db(row:UserInfo:u2)",
191
- },
192
- },
193
190
  ],
194
191
  },
195
192
  ],
@@ -221,25 +218,6 @@ exports[`useRow > otel > should update the data based on component key strictMod
221
218
  ",
222
219
  },
223
220
  },
224
- {
225
- "_name": "LiveStore:createStore",
226
- },
227
- {
228
- "_name": "sql-in-memory-select",
229
- "attributes": {
230
- "sql.cached": false,
231
- "sql.query": "SELECT 1 FROM 'UserInfo' WHERE id = ?",
232
- "sql.rowsCount": 0,
233
- },
234
- },
235
- {
236
- "_name": "sql-in-memory-select",
237
- "attributes": {
238
- "sql.cached": false,
239
- "sql.query": "SELECT 1 FROM 'UserInfo' WHERE id = ?",
240
- "sql.rowsCount": 1,
241
- },
242
- },
243
221
  {
244
222
  "_name": "LiveStore:sync",
245
223
  },
@@ -249,22 +227,17 @@ exports[`useRow > otel > should update the data based on component key strictMod
249
227
  {
250
228
  "_name": "LiveStore:mutate",
251
229
  "attributes": {
252
- "livestore.mutateLabel": "mutate",
230
+ "livestore.mutationEventTags": [
231
+ "_Derived_Create_UserInfo",
232
+ ],
233
+ "livestore.mutationEventsCount": 1,
253
234
  },
254
235
  "children": [
255
236
  {
256
- "_name": "LiveStore:mutate:applyMutations",
237
+ "_name": "livestore.in-memory-db:execute",
257
238
  "attributes": {
258
- "livestore.mutateLabel": "mutate",
239
+ "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
259
240
  },
260
- "children": [
261
- {
262
- "_name": "livestore.in-memory-db:execute",
263
- "attributes": {
264
- "sql.query": "INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')",
265
- },
266
- },
267
- ],
268
241
  },
269
242
  ],
270
243
  },
@@ -274,60 +247,67 @@ exports[`useRow > otel > should update the data based on component key strictMod
274
247
  "_name": "LiveStore:queries",
275
248
  "children": [
276
249
  {
277
- "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
250
+ "_name": "LiveStore:useRow:UserInfo:u1",
278
251
  "attributes": {
279
- "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
280
- "sql.rowsCount": 1,
252
+ "firstStackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
253
+ "label": "SELECT * FROM 'UserInfo' WHERE id = ?",
281
254
  },
282
255
  "children": [
283
256
  {
284
257
  "_name": "sql-in-memory-select",
285
258
  "attributes": {
286
259
  "sql.cached": false,
287
- "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
288
- "sql.rowsCount": 1,
260
+ "sql.query": "SELECT 1 FROM 'UserInfo' WHERE id = ?",
261
+ "sql.rowsCount": 0,
289
262
  },
290
263
  },
291
- ],
292
- },
293
- {
294
- "_name": "LiveStore:useRow:UserInfo:u1",
295
- "attributes": {
296
- "id": "u1",
297
- },
298
- "children": [
299
264
  {
300
265
  "_name": "LiveStore:mutate",
301
266
  "attributes": {
302
- "livestore.mutateLabel": "mutate",
267
+ "livestore.mutateLabel": "rowQuery:UserInfo:u1",
268
+ "livestore.mutationEventTags": [
269
+ "_Derived_Create_UserInfo",
270
+ ],
271
+ "livestore.mutationEventsCount": 1,
303
272
  },
304
273
  "children": [
305
274
  {
306
- "_name": "LiveStore:mutate:applyMutations",
275
+ "_name": "livestore.in-memory-db:execute",
307
276
  "attributes": {
308
- "livestore.mutateLabel": "mutate",
277
+ "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
309
278
  },
310
- "children": [
311
- {
312
- "_name": "livestore.in-memory-db:execute",
313
- "attributes": {
314
- "sql.query": "INSERT INTO UserInfo (username, text, id) VALUES ($username, $text, $id)",
315
- },
316
- },
317
- ],
318
279
  },
319
280
  ],
320
281
  },
321
282
  {
322
- "_name": "LiveStore:useQuery:db(row:UserInfo:u1)",
283
+ "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
323
284
  "attributes": {
324
- "label": "db(row:UserInfo:u1)",
325
- "stackInfo": "{"frames":[{"name":"renderHook.wrapper","filePath":"__REPLACED_FOR_SNAPSHOT__"},{"name":"useRow","filePath":"__REPLACED_FOR_SNAPSHOT__"}]}",
285
+ "livestore.debugRefreshReason": "useQuery:initial-run:row:UserInfo:u1",
286
+ "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
287
+ "sql.rowsCount": 1,
288
+ },
289
+ "children": [
290
+ {
291
+ "_name": "sql-in-memory-select",
292
+ "attributes": {
293
+ "sql.cached": false,
294
+ "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
295
+ "sql.rowsCount": 1,
296
+ },
297
+ },
298
+ ],
299
+ },
300
+ {
301
+ "_name": "LiveStore.subscribe",
302
+ "attributes": {
303
+ "label": "row:UserInfo:u1",
304
+ "queryLabel": "row:UserInfo:u1",
326
305
  },
327
306
  "children": [
328
307
  {
329
308
  "_name": "db:SELECT * FROM 'UserInfo' WHERE id = ?",
330
309
  "attributes": {
310
+ "livestore.debugRefreshReason": "mutate",
331
311
  "sql.query": "SELECT * FROM 'UserInfo' WHERE id = ?",
332
312
  "sql.rowsCount": 1,
333
313
  },
@@ -342,13 +322,6 @@ exports[`useRow > otel > should update the data based on component key strictMod
342
322
  },
343
323
  ],
344
324
  },
345
- {
346
- "_name": "LiveStore.subscribe",
347
- "attributes": {
348
- "label": "db(row:UserInfo:u1)",
349
- "queryLabel": "db(row:UserInfo:u1)",
350
- },
351
- },
352
325
  ],
353
326
  },
354
327
  ],
@@ -358,3 +331,225 @@ exports[`useRow > otel > should update the data based on component key strictMod
358
331
  ],
359
332
  }
360
333
  `;
334
+
335
+ exports[`useRow > should update the data based on component key 1`] = `
336
+ {
337
+ "atoms": [
338
+ {
339
+ "_tag": "ref",
340
+ "id": "node-1",
341
+ "isDestroyed": false,
342
+ "isDirty": false,
343
+ "label": "tableRef:todos",
344
+ "meta": {
345
+ "liveStoreRefType": "table",
346
+ },
347
+ "previousResult": {
348
+ "_tag": "Some",
349
+ "value": "null",
350
+ },
351
+ "refreshes": 0,
352
+ "sub": [],
353
+ "super": [],
354
+ },
355
+ {
356
+ "_tag": "ref",
357
+ "id": "node-2",
358
+ "isDestroyed": false,
359
+ "isDirty": false,
360
+ "label": "tableRef:app",
361
+ "meta": {
362
+ "liveStoreRefType": "table",
363
+ },
364
+ "previousResult": {
365
+ "_tag": "Some",
366
+ "value": "null",
367
+ },
368
+ "refreshes": 0,
369
+ "sub": [],
370
+ "super": [],
371
+ },
372
+ {
373
+ "_tag": "ref",
374
+ "id": "node-3",
375
+ "isDestroyed": false,
376
+ "isDirty": false,
377
+ "label": "tableRef:UserInfo",
378
+ "meta": {
379
+ "liveStoreRefType": "table",
380
+ },
381
+ "previousResult": {
382
+ "_tag": "Some",
383
+ "value": "null",
384
+ },
385
+ "refreshes": 1,
386
+ "sub": [],
387
+ "super": [
388
+ "node-5",
389
+ ],
390
+ },
391
+ {
392
+ "_tag": "ref",
393
+ "id": "node-4",
394
+ "isDestroyed": false,
395
+ "isDirty": false,
396
+ "label": "tableRef:AppRouter",
397
+ "meta": {
398
+ "liveStoreRefType": "table",
399
+ },
400
+ "previousResult": {
401
+ "_tag": "Some",
402
+ "value": "null",
403
+ },
404
+ "refreshes": 0,
405
+ "sub": [],
406
+ "super": [],
407
+ },
408
+ {
409
+ "_tag": "thunk",
410
+ "id": "node-5",
411
+ "isDestroyed": false,
412
+ "isDirty": false,
413
+ "label": "row:UserInfo:u1:results",
414
+ "meta": {
415
+ "liveStoreThunkType": "db.result",
416
+ },
417
+ "previousResult": {
418
+ "_tag": "Some",
419
+ "value": "{"username":"","text":"","id":"u1"}",
420
+ },
421
+ "recomputations": 1,
422
+ "sub": [
423
+ "node-3",
424
+ ],
425
+ "super": [
426
+ "node-6",
427
+ ],
428
+ },
429
+ ],
430
+ "deferredEffects": [],
431
+ "effects": [
432
+ {
433
+ "_tag": "effect",
434
+ "id": "node-6",
435
+ "invocations": 1,
436
+ "isDestroyed": false,
437
+ "label": "subscribe:row:UserInfo:u1",
438
+ "sub": [
439
+ "node-5",
440
+ ],
441
+ },
442
+ ],
443
+ }
444
+ `;
445
+
446
+ exports[`useRow > should update the data based on component key 2`] = `
447
+ {
448
+ "atoms": [
449
+ {
450
+ "_tag": "ref",
451
+ "id": "node-1",
452
+ "isDestroyed": false,
453
+ "isDirty": false,
454
+ "label": "tableRef:todos",
455
+ "meta": {
456
+ "liveStoreRefType": "table",
457
+ },
458
+ "previousResult": {
459
+ "_tag": "Some",
460
+ "value": "null",
461
+ },
462
+ "refreshes": 0,
463
+ "sub": [],
464
+ "super": [],
465
+ },
466
+ {
467
+ "_tag": "ref",
468
+ "id": "node-2",
469
+ "isDestroyed": false,
470
+ "isDirty": false,
471
+ "label": "tableRef:app",
472
+ "meta": {
473
+ "liveStoreRefType": "table",
474
+ },
475
+ "previousResult": {
476
+ "_tag": "Some",
477
+ "value": "null",
478
+ },
479
+ "refreshes": 0,
480
+ "sub": [],
481
+ "super": [],
482
+ },
483
+ {
484
+ "_tag": "ref",
485
+ "id": "node-3",
486
+ "isDestroyed": false,
487
+ "isDirty": false,
488
+ "label": "tableRef:UserInfo",
489
+ "meta": {
490
+ "liveStoreRefType": "table",
491
+ },
492
+ "previousResult": {
493
+ "_tag": "Some",
494
+ "value": "null",
495
+ },
496
+ "refreshes": 2,
497
+ "sub": [],
498
+ "super": [
499
+ "node-7",
500
+ ],
501
+ },
502
+ {
503
+ "_tag": "ref",
504
+ "id": "node-4",
505
+ "isDestroyed": false,
506
+ "isDirty": false,
507
+ "label": "tableRef:AppRouter",
508
+ "meta": {
509
+ "liveStoreRefType": "table",
510
+ },
511
+ "previousResult": {
512
+ "_tag": "Some",
513
+ "value": "null",
514
+ },
515
+ "refreshes": 0,
516
+ "sub": [],
517
+ "super": [],
518
+ },
519
+ {
520
+ "_tag": "thunk",
521
+ "id": "node-7",
522
+ "isDestroyed": false,
523
+ "isDirty": false,
524
+ "label": "row:UserInfo:u2:results",
525
+ "meta": {
526
+ "liveStoreThunkType": "db.result",
527
+ },
528
+ "previousResult": {
529
+ "_tag": "Some",
530
+ "value": "{"username":"username_u2","text":"","id":"u2"}",
531
+ },
532
+ "recomputations": 2,
533
+ "sub": [
534
+ "node-3",
535
+ ],
536
+ "super": [
537
+ "node-8",
538
+ ],
539
+ },
540
+ ],
541
+ "deferredEffects": [],
542
+ "effects": [
543
+ {
544
+ "_tag": "effect",
545
+ "id": "node-8",
546
+ "invocations": 1,
547
+ "isDestroyed": false,
548
+ "label": "subscribe:row:UserInfo:u2",
549
+ "sub": [
550
+ "node-7",
551
+ ],
552
+ },
553
+ ],
554
+ }
555
+ `;
@@ -1,7 +1,7 @@
1
1
  import { provideOtel } from '@livestore/common'
2
2
  import { DbSchema, makeSchema } from '@livestore/common/schema'
3
3
  import type { LiveStoreContextRunning } from '@livestore/livestore'
4
- import { createStore, globalReactivityGraph, makeReactivityGraph } from '@livestore/livestore'
4
+ import { createStore } from '@livestore/livestore'
5
5
  import { Effect } from '@livestore/utils/effect'
6
6
  import { makeInMemoryAdapter } from '@livestore/web'
7
7
  import type * as otel from '@opentelemetry/api'
@@ -42,7 +42,7 @@ export const app = DbSchema.table(
42
42
  { isSingleton: true },
43
43
  )
44
44
 
45
- export const AppComponentSchema = DbSchema.table(
45
+ export const userInfo = DbSchema.table(
46
46
  'UserInfo',
47
47
  {
48
48
  username: DbSchema.text({ default: '' }),
@@ -59,18 +59,16 @@ export const AppRouterSchema = DbSchema.table(
59
59
  { isSingleton: true, deriveMutations: true },
60
60
  )
61
61
 
62
- export const tables = { todos, app, AppComponentSchema, AppRouterSchema }
62
+ export const tables = { todos, app, userInfo, AppRouterSchema }
63
63
  export const schema = makeSchema({ tables })
64
64
 
65
65
  export const makeTodoMvcReact = ({
66
66
  otelTracer,
67
67
  otelContext,
68
- useGlobalReactivityGraph = true,
69
68
  strictMode,
70
69
  }: {
71
70
  otelTracer?: otel.Tracer
72
71
  otelContext?: otel.Context
73
- useGlobalReactivityGraph?: boolean
74
72
  strictMode?: boolean
75
73
  } = {}) =>
76
74
  Effect.gen(function* () {
@@ -89,13 +87,10 @@ export const makeTodoMvcReact = ({
89
87
  }
90
88
  }
91
89
 
92
- const reactivityGraph = useGlobalReactivityGraph ? globalReactivityGraph : makeReactivityGraph()
93
-
94
90
  const store = yield* createStore({
95
91
  schema,
96
92
  storeId: 'default',
97
93
  adapter: makeInMemoryAdapter(),
98
- reactivityGraph,
99
94
  debug: { instanceId: 'test' },
100
95
  })
101
96
 
@@ -112,5 +107,7 @@ export const makeTodoMvcReact = ({
112
107
  </MaybeStrictMode>
113
108
  )
114
109
 
115
- return { wrapper, store, reactivityGraph, makeRenderCount }
110
+ const renderCount = makeRenderCount()
111
+
112
+ return { wrapper, store, renderCount }
116
113
  }).pipe(provideOtel({ parentSpanContext: otelContext, otelTracer }))