@livestore/livestore 0.0.24 → 0.0.27

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 (243) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/QueryCache.d.ts +3 -3
  3. package/dist/QueryCache.d.ts.map +1 -1
  4. package/dist/QueryCache.js +50 -60
  5. package/dist/QueryCache.js.map +1 -1
  6. package/dist/__tests__/react/fixture.d.ts +22 -7
  7. package/dist/__tests__/react/fixture.d.ts.map +1 -1
  8. package/dist/__tests__/react/fixture.js +14 -15
  9. package/dist/__tests__/react/fixture.js.map +1 -1
  10. package/dist/__tests__/react/useQuery.test.js +37 -12
  11. package/dist/__tests__/react/useQuery.test.js.map +1 -1
  12. package/dist/__tests__/react/useRow.test.d.ts +2 -0
  13. package/dist/__tests__/react/useRow.test.d.ts.map +1 -0
  14. package/dist/__tests__/react/useRow.test.js +131 -0
  15. package/dist/__tests__/react/useRow.test.js.map +1 -0
  16. package/dist/__tests__/react/utils/stack-info.test.js +32 -0
  17. package/dist/__tests__/react/utils/stack-info.test.js.map +1 -1
  18. package/dist/__tests__/reactive.test.js +51 -0
  19. package/dist/__tests__/reactive.test.js.map +1 -1
  20. package/dist/__tests__/reactiveQueries/sql.test.js +6 -13
  21. package/dist/__tests__/reactiveQueries/sql.test.js.map +1 -1
  22. package/dist/effect/LiveStore.d.ts +3 -3
  23. package/dist/effect/LiveStore.d.ts.map +1 -1
  24. package/dist/effect/LiveStore.js +2 -2
  25. package/dist/effect/LiveStore.js.map +1 -1
  26. package/dist/global-state.d.ts +19 -0
  27. package/dist/global-state.d.ts.map +1 -0
  28. package/dist/global-state.js +20 -0
  29. package/dist/global-state.js.map +1 -0
  30. package/dist/inMemoryDatabase.d.ts +6 -6
  31. package/dist/inMemoryDatabase.d.ts.map +1 -1
  32. package/dist/inMemoryDatabase.js +16 -10
  33. package/dist/inMemoryDatabase.js.map +1 -1
  34. package/dist/index.d.ts +9 -13
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +7 -8
  37. package/dist/index.js.map +1 -1
  38. package/dist/migrations.d.ts +4 -4
  39. package/dist/migrations.d.ts.map +1 -1
  40. package/dist/migrations.js +34 -28
  41. package/dist/migrations.js.map +1 -1
  42. package/dist/react/LiveStoreContext.js.map +1 -1
  43. package/dist/react/LiveStoreProvider.d.ts +2 -2
  44. package/dist/react/LiveStoreProvider.d.ts.map +1 -1
  45. package/dist/react/LiveStoreProvider.js.map +1 -1
  46. package/dist/react/index.d.ts +1 -2
  47. package/dist/react/index.d.ts.map +1 -1
  48. package/dist/react/index.js +1 -1
  49. package/dist/react/index.js.map +1 -1
  50. package/dist/react/useQuery.d.ts +3 -0
  51. package/dist/react/useQuery.d.ts.map +1 -1
  52. package/dist/react/useQuery.js +7 -6
  53. package/dist/react/useQuery.js.map +1 -1
  54. package/dist/react/useRow.d.ts +33 -0
  55. package/dist/react/useRow.d.ts.map +1 -0
  56. package/dist/react/useRow.js +136 -0
  57. package/dist/react/useRow.js.map +1 -0
  58. package/dist/react/useTemporaryQuery.d.ts +2 -0
  59. package/dist/react/useTemporaryQuery.d.ts.map +1 -1
  60. package/dist/react/useTemporaryQuery.js +28 -11
  61. package/dist/react/useTemporaryQuery.js.map +1 -1
  62. package/dist/react/utils/stack-info.d.ts.map +1 -1
  63. package/dist/react/utils/stack-info.js +3 -3
  64. package/dist/react/utils/stack-info.js.map +1 -1
  65. package/dist/react/utils/useStateRefWithReactiveInput.js.map +1 -1
  66. package/dist/reactive.d.ts +38 -29
  67. package/dist/reactive.d.ts.map +1 -1
  68. package/dist/reactive.js +73 -45
  69. package/dist/reactive.js.map +1 -1
  70. package/dist/reactiveQueries/base-class.d.ts +10 -6
  71. package/dist/reactiveQueries/base-class.d.ts.map +1 -1
  72. package/dist/reactiveQueries/base-class.js +11 -12
  73. package/dist/reactiveQueries/base-class.js.map +1 -1
  74. package/dist/reactiveQueries/graphql.d.ts +2 -2
  75. package/dist/reactiveQueries/graphql.d.ts.map +1 -1
  76. package/dist/reactiveQueries/graphql.js +56 -50
  77. package/dist/reactiveQueries/graphql.js.map +1 -1
  78. package/dist/reactiveQueries/js.d.ts +7 -3
  79. package/dist/reactiveQueries/js.d.ts.map +1 -1
  80. package/dist/reactiveQueries/js.js +25 -15
  81. package/dist/reactiveQueries/js.js.map +1 -1
  82. package/dist/reactiveQueries/sql.d.ts +5 -5
  83. package/dist/reactiveQueries/sql.d.ts.map +1 -1
  84. package/dist/reactiveQueries/sql.js +39 -34
  85. package/dist/reactiveQueries/sql.js.map +1 -1
  86. package/dist/row-query.d.ts +21 -0
  87. package/dist/row-query.d.ts.map +1 -0
  88. package/dist/row-query.js +77 -0
  89. package/dist/row-query.js.map +1 -0
  90. package/dist/schema/action.d.ts +30 -0
  91. package/dist/schema/action.d.ts.map +1 -0
  92. package/dist/schema/action.js +3 -0
  93. package/dist/schema/action.js.map +1 -0
  94. package/dist/schema/index.d.ts +28 -0
  95. package/dist/schema/index.d.ts.map +1 -0
  96. package/dist/schema/index.js +26 -0
  97. package/dist/schema/index.js.map +1 -0
  98. package/dist/schema/system-tables.d.ts +24 -0
  99. package/dist/schema/system-tables.d.ts.map +1 -0
  100. package/dist/schema/system-tables.js +11 -0
  101. package/dist/schema/system-tables.js.map +1 -0
  102. package/dist/schema/table-def.d.ts +161 -0
  103. package/dist/schema/table-def.d.ts.map +1 -0
  104. package/dist/schema/table-def.js +53 -0
  105. package/dist/schema/table-def.js.map +1 -0
  106. package/dist/storage/in-memory/index.d.ts +1 -1
  107. package/dist/storage/in-memory/index.d.ts.map +1 -1
  108. package/dist/storage/in-memory/index.js +6 -7
  109. package/dist/storage/in-memory/index.js.map +1 -1
  110. package/dist/storage/index.d.ts +1 -1
  111. package/dist/storage/index.d.ts.map +1 -1
  112. package/dist/storage/tauri/index.d.ts +1 -1
  113. package/dist/storage/tauri/index.d.ts.map +1 -1
  114. package/dist/storage/tauri/index.js +25 -23
  115. package/dist/storage/tauri/index.js.map +1 -1
  116. package/dist/storage/utils/idb.js +3 -1
  117. package/dist/storage/utils/idb.js.map +1 -1
  118. package/dist/storage/web-worker/index.d.ts +1 -1
  119. package/dist/storage/web-worker/index.d.ts.map +1 -1
  120. package/dist/storage/web-worker/index.js +38 -34
  121. package/dist/storage/web-worker/index.js.map +1 -1
  122. package/dist/storage/web-worker/worker.d.ts +1 -1
  123. package/dist/storage/web-worker/worker.d.ts.map +1 -1
  124. package/dist/storage/web-worker/worker.js +1 -1
  125. package/dist/storage/web-worker/worker.js.map +1 -1
  126. package/dist/store.d.ts +11 -21
  127. package/dist/store.d.ts.map +1 -1
  128. package/dist/store.js +284 -272
  129. package/dist/store.js.map +1 -1
  130. package/dist/utils/bounded-collections.d.ts.map +1 -0
  131. package/dist/utils/bounded-collections.js +90 -0
  132. package/dist/utils/bounded-collections.js.map +1 -0
  133. package/dist/utils/otel.d.ts.map +1 -0
  134. package/dist/{otel.js → utils/otel.js} +1 -1
  135. package/dist/utils/otel.js.map +1 -0
  136. package/dist/utils/util.d.ts.map +1 -0
  137. package/dist/utils/util.js.map +1 -0
  138. package/package.json +21 -18
  139. package/src/QueryCache.ts +4 -4
  140. package/src/__tests__/react/fixture.tsx +17 -17
  141. package/src/__tests__/react/useQuery.test.tsx +56 -14
  142. package/src/__tests__/react/useRow.test.tsx +205 -0
  143. package/src/__tests__/react/utils/stack-info.test.ts +34 -0
  144. package/src/__tests__/reactive.test.ts +71 -0
  145. package/src/__tests__/reactiveQueries/sql.test.ts +6 -13
  146. package/src/effect/LiveStore.ts +7 -7
  147. package/src/global-state.ts +26 -0
  148. package/src/inMemoryDatabase.ts +14 -12
  149. package/src/index.ts +22 -29
  150. package/src/migrations.ts +41 -35
  151. package/src/react/LiveStoreProvider.tsx +2 -2
  152. package/src/react/index.ts +7 -9
  153. package/src/react/useQuery.ts +12 -6
  154. package/src/react/useRow.ts +221 -0
  155. package/src/react/useTemporaryQuery.ts +43 -11
  156. package/src/react/utils/stack-info.ts +4 -3
  157. package/src/reactive.ts +81 -65
  158. package/src/reactiveQueries/base-class.ts +14 -10
  159. package/src/reactiveQueries/graphql.ts +4 -3
  160. package/src/reactiveQueries/js.ts +9 -5
  161. package/src/reactiveQueries/sql.ts +9 -9
  162. package/src/row-query.ts +142 -0
  163. package/src/schema/action.ts +41 -0
  164. package/src/schema/index.ts +63 -0
  165. package/src/schema/system-tables.ts +21 -0
  166. package/src/schema/table-def.ts +199 -0
  167. package/src/storage/in-memory/index.ts +1 -1
  168. package/src/storage/index.ts +2 -1
  169. package/src/storage/tauri/index.ts +2 -2
  170. package/src/storage/web-worker/index.ts +1 -1
  171. package/src/storage/web-worker/worker.ts +2 -2
  172. package/src/store.ts +51 -51
  173. package/dist/__tests__/react/useComponentState.test.d.ts +0 -2
  174. package/dist/__tests__/react/useComponentState.test.d.ts.map +0 -1
  175. package/dist/__tests__/react/useComponentState.test.js +0 -68
  176. package/dist/__tests__/react/useComponentState.test.js.map +0 -1
  177. package/dist/__tests__/react/useLQuery.test.d.ts +0 -2
  178. package/dist/__tests__/react/useLQuery.test.d.ts.map +0 -1
  179. package/dist/__tests__/react/useLQuery.test.js +0 -38
  180. package/dist/__tests__/react/useLQuery.test.js.map +0 -1
  181. package/dist/__tests__/react/useLiveStoreComponent.test.d.ts +0 -2
  182. package/dist/__tests__/react/useLiveStoreComponent.test.d.ts.map +0 -1
  183. package/dist/__tests__/react/useLiveStoreComponent.test.js +0 -73
  184. package/dist/__tests__/react/useLiveStoreComponent.test.js.map +0 -1
  185. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.d.ts +0 -2
  186. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.d.ts.map +0 -1
  187. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.js +0 -38
  188. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.js.map +0 -1
  189. package/dist/bounded-collections.d.ts.map +0 -1
  190. package/dist/bounded-collections.js +0 -103
  191. package/dist/bounded-collections.js.map +0 -1
  192. package/dist/componentKey.d.ts +0 -20
  193. package/dist/componentKey.d.ts.map +0 -1
  194. package/dist/componentKey.js +0 -3
  195. package/dist/componentKey.js.map +0 -1
  196. package/dist/otel.d.ts.map +0 -1
  197. package/dist/otel.js.map +0 -1
  198. package/dist/react/useComponentState.d.ts +0 -50
  199. package/dist/react/useComponentState.d.ts.map +0 -1
  200. package/dist/react/useComponentState.js +0 -240
  201. package/dist/react/useComponentState.js.map +0 -1
  202. package/dist/react/useGlobalQuery.d.ts +0 -3
  203. package/dist/react/useGlobalQuery.d.ts.map +0 -1
  204. package/dist/react/useGlobalQuery.js +0 -26
  205. package/dist/react/useGlobalQuery.js.map +0 -1
  206. package/dist/react/useGraphQL.d.ts +0 -13
  207. package/dist/react/useGraphQL.d.ts.map +0 -1
  208. package/dist/react/useGraphQL.js +0 -87
  209. package/dist/react/useGraphQL.js.map +0 -1
  210. package/dist/react/useLiveStoreComponent.d.ts +0 -75
  211. package/dist/react/useLiveStoreComponent.d.ts.map +0 -1
  212. package/dist/react/useLiveStoreComponent.js +0 -361
  213. package/dist/react/useLiveStoreComponent.js.map +0 -1
  214. package/dist/react/utils/extractNamesFromStackTrace.d.ts +0 -3
  215. package/dist/react/utils/extractNamesFromStackTrace.d.ts.map +0 -1
  216. package/dist/react/utils/extractNamesFromStackTrace.js +0 -40
  217. package/dist/react/utils/extractNamesFromStackTrace.js.map +0 -1
  218. package/dist/react/utils/extractStackInfoFromStackTrace.d.ts +0 -7
  219. package/dist/react/utils/extractStackInfoFromStackTrace.d.ts.map +0 -1
  220. package/dist/react/utils/extractStackInfoFromStackTrace.js +0 -40
  221. package/dist/react/utils/extractStackInfoFromStackTrace.js.map +0 -1
  222. package/dist/reactiveQueries/graph.d.ts +0 -10
  223. package/dist/reactiveQueries/graph.d.ts.map +0 -1
  224. package/dist/reactiveQueries/graph.js +0 -6
  225. package/dist/reactiveQueries/graph.js.map +0 -1
  226. package/dist/schema.d.ts +0 -81
  227. package/dist/schema.d.ts.map +0 -1
  228. package/dist/schema.js +0 -46
  229. package/dist/schema.js.map +0 -1
  230. package/dist/util.d.ts.map +0 -1
  231. package/dist/util.js.map +0 -1
  232. package/src/__tests__/react/useComponentState.test.tsx +0 -100
  233. package/src/componentKey.ts +0 -9
  234. package/src/react/useComponentState.ts +0 -404
  235. package/src/reactiveQueries/graph.ts +0 -15
  236. package/src/schema.ts +0 -143
  237. /package/dist/{bounded-collections.d.ts → utils/bounded-collections.d.ts} +0 -0
  238. /package/dist/{otel.d.ts → utils/otel.d.ts} +0 -0
  239. /package/dist/{util.d.ts → utils/util.d.ts} +0 -0
  240. /package/dist/{util.js → utils/util.js} +0 -0
  241. /package/src/{bounded-collections.ts → utils/bounded-collections.ts} +0 -0
  242. /package/src/{otel.ts → utils/otel.ts} +0 -0
  243. /package/src/{util.ts → utils/util.ts} +0 -0
package/dist/schema.js DELETED
@@ -1,46 +0,0 @@
1
- import { mapObjectValues } from '@livestore/utils';
2
- import { SqliteDsl } from 'effect-db-schema';
3
- import { DbSchema } from './index.js';
4
- // A global variable representing component state tables we should create in the database
5
- export const componentStateTables = {};
6
- export const makeSchema = (schema) => ({
7
- tables: { ...mapObjectValues(schema.tables, (_tableName, table) => table.ast), ...systemTables },
8
- materializedViews: schema.materializedViews ?? {},
9
- actions: schema.actions,
10
- });
11
- // TODO get rid of "side effect" in this function (via explicit register fn)
12
- export const defineComponentStateSchema = (
13
- // TODO get rid of the `name` param here and use the `componentKey` name instead
14
- name, columns) => {
15
- const tablePath = `components__${name}`;
16
- if (Object.keys(componentStateTables).includes(tablePath)) {
17
- // throw new Error(`Can't register duplicate component: ${name}`)
18
- console.error(`Can't register duplicate component: ${tablePath}`);
19
- }
20
- const schemaWithId = columns;
21
- schemaWithId.id = DbSchema.text({ primaryKey: true });
22
- const tableDef = SqliteDsl.table(tablePath, schemaWithId, []);
23
- // TODO move into register fn
24
- componentStateTables[tablePath] = tableDef.ast;
25
- return tableDef;
26
- };
27
- export const SCHEMA_META_TABLE = '__livestore_schema';
28
- const schemaMetaTable = SqliteDsl.table(SCHEMA_META_TABLE, {
29
- tableName: SqliteDsl.text({ primaryKey: true }),
30
- schemaHash: SqliteDsl.integer({ nullable: false }),
31
- /** ISO date format */
32
- updatedAt: SqliteDsl.text({ nullable: false }),
33
- });
34
- export const systemTables = {
35
- // [EVENTS_TABLE_NAME]: SqliteDsl.table(EVENTS_TABLE_NAME, {
36
- // id: SqliteDsl.text({ primaryKey: true }),
37
- // type: SqliteDsl.text({ nullable: false }),
38
- // args: SqliteDsl.text({ nullable: false }),
39
- // }).ast,
40
- [SCHEMA_META_TABLE]: schemaMetaTable.ast,
41
- };
42
- export const defineTables = (tables) => tables;
43
- export const defineMaterializedViews = (materializedViews) => materializedViews;
44
- export const defineActions = (actions) => actions;
45
- export const defineAction = (action) => action;
46
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AASrC,yFAAyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAuC,EAAE,CAAA;AAU1E,MAAM,CAAC,MAAM,UAAU,GAAG,CAA8B,MAAe,EAAU,EAAE,CACjF,CAAC;IACC,MAAM,EAAE,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,YAAY,EAAE;IAChG,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC,OAAO;CACxB,CAAkB,CAAA;AAOrB,4EAA4E;AAC5E,MAAM,CAAC,MAAM,0BAA0B,GAAG;AACxC,gFAAgF;AAChF,IAAW,EACX,OAAiB,EAIjB,EAAE;IACF,MAAM,SAAS,GAAG,eAAe,IAAI,EAAW,CAAA;IAChD,IAAI,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACzD,iEAAiE;QACjE,OAAO,CAAC,KAAK,CAAC,uCAAuC,SAAS,EAAE,CAAC,CAAA;KAClE;IAED,MAAM,YAAY,GAAG,OAIpB,CAAA;IAED,YAAY,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAErD,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,CAAC,CAAA;IAE7D,6BAA6B;IAC7B,oBAAoB,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAA;IAE9C,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AA4BD,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAA;AAErD,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,iBAAiB,EAAE;IACzD,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC/C,UAAU,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClD,sBAAsB;IACtB,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;CAC/C,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,4DAA4D;IAC5D,8CAA8C;IAC9C,+CAA+C;IAC/C,+CAA+C;IAC/C,UAAU;IACV,CAAC,iBAAiB,CAAC,EAAE,eAAe,CAAC,GAAG;CACd,CAAA;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAA6B,MAAS,EAAE,EAAE,CAAC,MAAM,CAAA;AAE7E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAwC,iBAAoB,EAAE,EAAE,CACrG,iBAAiB,CAAA;AAEnB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAmC,OAAU,EAAE,EAAE,CAAC,OAAO,CAAA;AACtF,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAA+B,EACN,EAAE,CAAC,MAAM,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEpD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AACnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,CAAA;AAE1D,MAAM,MAAM,QAAQ,GAAG,QAAQ,EAAE,GAAG,YAAY,CAAA;AAEhD,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAA;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,GAAG,aAAc,oBAAoB,WAAW,OAAO,EAAE,KAAG,MAMxE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,QAAQ,aAAa,MAAM,KAAG,kBAWvE,CAAA;AAED;;;GAGG;AAEH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,CAE5C;AAED,eAAO,MAAM,cAAc,UAAW,GAAG,KAAG,MAa3C,CAAA;AAED,eAAO,MAAM,SAAS,UAAW,GAAG,8BAAiE,CAAA"}
package/dist/util.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAW9B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,QAA8B,EAAE,GAAG,IAAe,EAAU,EAAE;IAChF,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,KAAK,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;QACrC,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;KACjC;IACD,OAAO,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAgB,EAAE,SAAiB,EAAsB,EAAE;IAC3F,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,MAA4B,CAAA;IAE9D,MAAM,MAAM,GAAiB,EAAE,CAAA;IAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACjD,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC3B,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAA;SAC1B;KACF;IAED,OAAO,MAA4B,CAAA;AACrC,CAAC,CAAA;AAED;;;GAGG;AACH,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,CAAQ;IACnC,MAAM,IAAI,KAAK,CAAC,qCAAqC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAC3E,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAU,EAAU,EAAE;IACnD,MAAM,KAAK,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;IAC9F,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1C,IAAI,GAAG,KAAK,iBAAiB;QAAE,OAAO,GAAG,GAAG,QAAQ,CAAA;IAEpD,IAAI;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;KACpD;IAAC,OAAO,CAAM,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAElB,OAAO,8BAA8B,GAAG,CAAC,CAAA;KAC1C;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAU,EAA6B,EAAE,CAAC,OAAO,KAAK,EAAE,IAAI,KAAK,UAAU,CAAA"}
@@ -1,100 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react'
2
- import { describe, expect, it } from 'vitest'
3
-
4
- import { sql } from '../../index.js'
5
- import * as LiveStoreReact from '../../react/index.js'
6
- import { makeTodoMvc } from './fixture.js'
7
-
8
- describe('useComponentState', () => {
9
- it('should update the data based on component key', async () => {
10
- let renderCount = 0
11
-
12
- const { wrapper, AppSchema, store } = await makeTodoMvc()
13
-
14
- const { result, rerender } = renderHook(
15
- (userId: string) => {
16
- renderCount++
17
-
18
- return LiveStoreReact.useComponentState({
19
- schema: AppSchema,
20
- componentKey: { name: 'UserInfo', id: userId },
21
- })
22
- },
23
- { wrapper, initialProps: 'u1' },
24
- )
25
-
26
- expect(result.current.state.id).toBe('u1')
27
- expect(result.current.state.username).toBe('')
28
- expect(renderCount).toBe(1)
29
-
30
- act(() => {
31
- void store.execute(sql`INSERT INTO components__UserInfo (id, username) VALUES ('u2', 'username_u2');`)
32
- })
33
-
34
- rerender('u2')
35
-
36
- expect(result.current.state.id).toBe('u2')
37
- expect(result.current.state.username).toBe('username_u2')
38
- expect(renderCount).toBe(2)
39
- })
40
-
41
- it('should update the data reactively - via setState', async () => {
42
- let renderCount = 0
43
-
44
- const { wrapper, AppSchema } = await makeTodoMvc()
45
-
46
- const { result } = renderHook(
47
- (userId: string) => {
48
- renderCount++
49
-
50
- return LiveStoreReact.useComponentState({
51
- schema: AppSchema,
52
- componentKey: { name: 'UserInfo', id: userId },
53
- })
54
- },
55
- { wrapper, initialProps: 'u1' },
56
- )
57
-
58
- expect(result.current.state.id).toBe('u1')
59
- expect(result.current.state.username).toBe('')
60
- expect(renderCount).toBe(1)
61
-
62
- act(() => result.current.setState.username('username_u1_hello'))
63
-
64
- expect(result.current.state.id).toBe('u1')
65
- expect(result.current.state.username).toBe('username_u1_hello')
66
- expect(renderCount).toBe(2)
67
- })
68
-
69
- it('should update the data reactively - via raw store update', async () => {
70
- let renderCount = 0
71
-
72
- const { wrapper, AppSchema, store } = await makeTodoMvc()
73
-
74
- const { result } = renderHook(
75
- (userId: string) => {
76
- renderCount++
77
-
78
- return LiveStoreReact.useComponentState({
79
- schema: AppSchema,
80
- componentKey: { name: 'UserInfo', id: userId },
81
- })
82
- },
83
- { wrapper, initialProps: 'u1' },
84
- )
85
-
86
- expect(result.current.state.id).toBe('u1')
87
- expect(result.current.state.username).toBe('')
88
- expect(renderCount).toBe(1)
89
-
90
- act(() => result.current.setState.username('username_u1_hello'))
91
-
92
- act(() => {
93
- void store.execute(sql`UPDATE components__UserInfo SET username = 'username_u1_hello' WHERE id = 'u1';`)
94
- })
95
-
96
- expect(result.current.state.id).toBe('u1')
97
- expect(result.current.state.username).toBe('username_u1_hello')
98
- expect(renderCount).toBe(2)
99
- })
100
- })
@@ -1,9 +0,0 @@
1
- type SingletonKey = { _tag: 'singleton'; componentName: string; id: 'singleton' }
2
- type EphemeralKey = { _tag: 'ephemeral'; componentName: string; id: string }
3
- type CustomKey = { _tag: 'custom'; componentName: string; id: string }
4
-
5
- export type ComponentKey = SingletonKey | EphemeralKey | CustomKey
6
-
7
- export const labelForKey = (key: ComponentKey): string => `${key.componentName}/${key.id}`
8
-
9
- export const tableNameForComponentKey = (componentKey: ComponentKey) => `components__${componentKey.componentName}`
@@ -1,404 +0,0 @@
1
- import type { LiteralUnion } from '@livestore/utils'
2
- import { omit, shouldNeverHappen } from '@livestore/utils'
3
- import { Schema } from '@livestore/utils/effect'
4
- import * as otel from '@opentelemetry/api'
5
- import { SqliteAst, SqliteDsl } from 'effect-db-schema'
6
- import { isEqual, mapValues } from 'lodash-es'
7
- import type { DependencyList } from 'react'
8
- import React from 'react'
9
- import { v4 as uuid } from 'uuid'
10
-
11
- import type { ComponentKey } from '../componentKey.js'
12
- import { labelForKey, tableNameForComponentKey } from '../componentKey.js'
13
- import { migrateTable } from '../migrations.js'
14
- import { LiveStoreJSQuery } from '../reactiveQueries/js.js'
15
- import { LiveStoreSQLQuery } from '../reactiveQueries/sql.js'
16
- import { SCHEMA_META_TABLE } from '../schema.js'
17
- import type { BaseGraphQLContext, LiveStoreQuery, Store } from '../store.js'
18
- import { sql } from '../util.js'
19
- import { useStore } from './LiveStoreContext.js'
20
- import { extractStackInfoFromStackTrace, originalStackLimit } from './utils/stack-info.js'
21
- import { useStateRefWithReactiveInput } from './utils/useStateRefWithReactiveInput.js'
22
-
23
- export interface QueryDefinitions {
24
- [queryName: string]: LiveStoreQuery
25
- }
26
-
27
- export type UseComponentStateProps<TStateColumns extends ComponentColumns> = {
28
- schema?: SqliteDsl.TableDefinition<string, TStateColumns>
29
- reactDeps?: React.DependencyList
30
- componentKey: ComponentKeyConfig
31
- }
32
-
33
- export type ComponentKeyConfig = {
34
- /**
35
- * Name of the Component
36
- *
37
- * TODO we should eventually derive this info automatically from the component (TBD how though...)
38
- */
39
- name: string
40
- id: LiteralUnion<'singleton' | '__ephemeral__', string>
41
- }
42
-
43
- // TODO enforce columns are non-nullable or have a default
44
- export interface ComponentColumns extends SqliteDsl.Columns {
45
- id: SqliteDsl.ColumnDefinition<SqliteDsl.FieldType.FieldTypeText<string, string>, false>
46
- }
47
-
48
- // type ComponentState = {
49
- // /** Equivalent to `componentKey.key` */
50
- // id: string
51
- // [key: string]: string | number | boolean | null
52
- // }
53
-
54
- /**
55
- * This is needed because the `React.useMemo` call below, can sometimes be called multiple times 🤷,
56
- * so we need to "cache" the fact that we've already started a span for this component.
57
- * The map entry is being removed again in the `React.useEffect` call below.
58
- */
59
- const spanAlreadyStartedCache = new Map<string, { span: otel.Span; otelContext: otel.Context }>()
60
-
61
- type UseLiveStoreJsonState<TState> = <TResult>(
62
- jsonStringKey: keyof TState,
63
- parse?: (_: unknown) => TResult,
64
- ) => [value: TResult, setValue: (newVal: TResult | ((prevVal: TResult) => TResult)) => void]
65
-
66
- export type GetStateType<TTableDef extends SqliteDsl.TableDefinition<any, any>> = SqliteDsl.FromColumns.RowDecoded<
67
- TTableDef['columns']
68
- >
69
-
70
- export type GetStateTypeEncoded<TTableDef extends SqliteDsl.TableDefinition<any, any>> =
71
- SqliteDsl.FromColumns.RowEncoded<TTableDef['columns']>
72
-
73
- /**
74
- * Create reactive queries within a component.
75
- * @param config.queries A function that returns a map of named reactive queries.
76
- * @param config.componentKey A function that returns a unique key for this component.
77
- * @param config.reactDeps A list of React-level dependencies that will refresh the queries.
78
- */
79
- export const useComponentState = <TStateColumns extends ComponentColumns>({
80
- schema: stateSchema_,
81
- componentKey: componentKeyConfig,
82
- reactDeps = [],
83
- }: UseComponentStateProps<TStateColumns>): {
84
- state$: LiveStoreJSQuery<SqliteDsl.FromColumns.RowDecoded<TStateColumns>>
85
- state: SqliteDsl.FromColumns.RowDecoded<TStateColumns>
86
- setState: Setters<SqliteDsl.FromColumns.RowDecoded<TStateColumns>>
87
- useLiveStoreJsonState: UseLiveStoreJsonState<SqliteDsl.FromColumns.RowDecoded<TStateColumns>>
88
- } => {
89
- type TComponentState = SqliteDsl.FromColumns.RowDecoded<TStateColumns>
90
-
91
- // TODO validate schema to make sure each column has a default value
92
- // TODO we should clean up the state schema handling to remove this special handling for the `id` column
93
- const stateSchema = React.useMemo(
94
- () => (stateSchema_ ? { ...stateSchema_, columns: omit(stateSchema_.columns, 'id' as any) } : undefined),
95
- [stateSchema_],
96
- )
97
-
98
- const componentKey = useComponentKey(componentKeyConfig, reactDeps)
99
- const { store } = useStore()
100
-
101
- const componentKeyLabel = React.useMemo(() => labelForKey(componentKey), [componentKey])
102
-
103
- const stackInfo = React.useMemo(() => {
104
- Error.stackTraceLimit = 10
105
- // eslint-disable-next-line unicorn/error-message
106
- const stack = new Error().stack!
107
- Error.stackTraceLimit = originalStackLimit
108
- return extractStackInfoFromStackTrace(stack)
109
- }, [])
110
-
111
- // The following `React.useMemo` and `React.useEffect` calls are used to start and end a span for the lifetime of this component.
112
- const { span, otelContext } = React.useMemo(() => {
113
- const existingSpan = spanAlreadyStartedCache.get(componentKeyLabel)
114
- if (existingSpan !== undefined) return existingSpan
115
-
116
- const span = store.otel.tracer.startSpan(
117
- `LiveStore:useComponentState:${componentKeyLabel}`,
118
- { attributes: { stackInfo: JSON.stringify(stackInfo) } },
119
- store.otel.queriesSpanContext,
120
- )
121
-
122
- const otelContext = otel.trace.setSpan(otel.context.active(), span)
123
-
124
- spanAlreadyStartedCache.set(componentKeyLabel, { span, otelContext })
125
-
126
- return { span, otelContext }
127
- }, [componentKeyLabel, stackInfo, store.otel.queriesSpanContext, store.otel.tracer])
128
-
129
- React.useEffect(
130
- () => () => {
131
- spanAlreadyStartedCache.delete(componentKeyLabel)
132
- span.end()
133
- },
134
- [componentKeyLabel, span],
135
- )
136
-
137
- const defaultComponentState = React.useMemo(() => {
138
- const defaultState = (
139
- stateSchema === undefined ? {} : mapValues(stateSchema.columns, (c) => c.default)
140
- ) as TComponentState
141
-
142
- // @ts-expect-error TODO fix typing
143
- defaultState.id = componentKeyConfig.id
144
-
145
- return defaultState
146
- }, [componentKeyConfig.id, stateSchema])
147
-
148
- const componentStateEffectSchema = React.useMemo(
149
- () => (stateSchema ? SqliteDsl.structSchemaForTable(stateSchema) : Schema.any),
150
- [stateSchema],
151
- )
152
-
153
- const state$ = React.useMemo(() => {
154
- // create state query
155
- if (stateSchema === undefined) {
156
- // TODO don't set up a query if there's no state schema (keeps the graph more clean)
157
- return new LiveStoreJSQuery({
158
- fn: () => ({}) as TComponentState,
159
- label: 'empty-component-state',
160
- // otelContext,
161
- // otelTracer: store.otel.tracer,
162
- })
163
- } else {
164
- const componentTableName = tableNameForComponentKey(componentKey)
165
- const whereClause = componentKey._tag === 'singleton' ? '' : `where id = '${componentKey.id}'`
166
-
167
- // TODO find a better solution for this
168
- if (store.tableRefs[componentTableName] === undefined) {
169
- const schemaHash = SqliteAst.hash(stateSchema.ast)
170
- const res = store.inMemoryDB.select<{ schemaHash: number }>(
171
- sql`SELECT schemaHash FROM ${SCHEMA_META_TABLE} WHERE tableName = '${componentTableName}'`,
172
- )
173
- if (res.length === 0 || res[0]!.schemaHash !== schemaHash) {
174
- migrateTable({ db: store._proxyDb, tableDef: stateSchema.ast, otelContext, schemaHash })
175
- }
176
-
177
- store.tableRefs[componentTableName] = store.graph.makeRef(null, {
178
- equal: () => false,
179
- label: componentTableName,
180
- meta: { liveStoreRefType: 'table' },
181
- })
182
- }
183
-
184
- return (
185
- new LiveStoreSQLQuery({
186
- label: `localState:query:${componentKeyLabel}`,
187
- genQueryString: () => sql`select * from ${componentTableName} ${whereClause} limit 1`,
188
- queriedTables: [componentTableName],
189
- })
190
- // TODO consider to instead of just returning the default value, to write the default component state to the DB
191
- .pipe<TComponentState>((results) =>
192
- results.length === 1 ? Schema.parseSync(componentStateEffectSchema)(results[0]!) : defaultComponentState,
193
- )
194
- )
195
- }
196
- }, [
197
- componentKey,
198
- componentKeyLabel,
199
- componentStateEffectSchema,
200
- defaultComponentState,
201
- otelContext,
202
- stateSchema,
203
- store,
204
- ])
205
-
206
- // Step 1:
207
- // Synchronously create state and queries for initial render pass.
208
- const initialComponentState = React.useMemo(
209
- () => state$.run(otelContext, { _tag: 'react', api: 'useComponentState', label: state$.label, stackInfo }),
210
- [otelContext, stackInfo, state$],
211
- )
212
-
213
- // Now that we've computed the initial state synchronously,
214
- // we can set up our useState calls w/ a default value populated...
215
- const [componentStateRef, setComponentState_] = useStateRefWithReactiveInput<TComponentState>(initialComponentState)
216
-
217
- const setState = (
218
- stateSchema === undefined
219
- ? {}
220
- : // TODO: do we have a better type for the values that can go in SQLite?
221
- mapValues(stateSchema.columns, (column, columnName) => (value: string | number) => {
222
- // Don't update the state if it's the same as the value already seen in the component
223
- // @ts-expect-error TODO fix typing
224
- if (componentStateRef.current[columnName] === value) return
225
-
226
- const encodedValue = Schema.encodeSync(column.type.codec)(value)
227
-
228
- if (['componentKey', 'columnNames'].includes(columnName)) {
229
- shouldNeverHappen(`Can't use reserved column name ${columnName}`)
230
- }
231
-
232
- return store.applyEvent('updateComponentState', {
233
- componentKey,
234
- columnNames: [columnName],
235
- [columnName]: encodedValue,
236
- })
237
- })
238
- ) as Setters<TComponentState>
239
-
240
- setState.setMany = (columnValues: Partial<TComponentState>) => {
241
- // TODO use hashing instead
242
- // Don't update the state if it's the same as the value already seen in the component
243
- // @ts-expect-error TODO fix typing
244
- if (Object.entries(columnValues).every(([columnName, value]) => componentStateRef.current[columnName] === value)) {
245
- return
246
- }
247
-
248
- const columnNames = Object.keys(columnValues)
249
-
250
- return store.applyEvent('updateComponentState', { componentKey, columnNames, ...columnValues })
251
- }
252
-
253
- // OK, now all the synchronous work is done;
254
- // time to set up our long-running queries in an effect
255
- React.useEffect(() => {
256
- return store.otel.tracer.startActiveSpan(
257
- 'LiveStore:useComponentState:long-running',
258
- { attributes: {} },
259
- otelContext,
260
- (span) => {
261
- const unsubs: (() => void)[] = []
262
-
263
- const otelContext = otel.trace.setSpan(otel.context.active(), span)
264
- if (stateSchema !== undefined) {
265
- insertRowForComponentInstance({ store, componentKey, stateSchema, otelContext })
266
- }
267
-
268
- state$.activeSubscriptions.add(stackInfo)
269
-
270
- unsubs.push(
271
- store.subscribe(
272
- state$,
273
- (results) => {
274
- if (isEqual(results, componentStateRef.current) === false) {
275
- setComponentState_(results as TComponentState)
276
- }
277
- },
278
- undefined,
279
- { label: `useComponentState:localState:subscribe:${state$.label}`, otelContext },
280
- ),
281
- () => state$.activeSubscriptions.delete(stackInfo),
282
- )
283
-
284
- return () => {
285
- for (const unsub of unsubs) {
286
- unsub()
287
- }
288
-
289
- span.end()
290
- }
291
- },
292
- )
293
- }, [
294
- store,
295
- stackInfo,
296
- stateSchema,
297
- defaultComponentState,
298
- otelContext,
299
- componentStateRef,
300
- state$,
301
- setComponentState_,
302
- componentKey,
303
- ])
304
-
305
- React.useEffect(() => () => state$.destroy(), [state$])
306
-
307
- const state = componentStateRef.current
308
-
309
- const useLiveStoreJsonState = <TResult>(
310
- jsonStringKey: keyof TComponentState,
311
- parse: (_: unknown) => TResult = (_) => _ as TResult,
312
- ): [value: TResult, setValue: (newVal: TResult | ((prevVal: TResult) => TResult)) => void] => {
313
- const value = React.useMemo<TResult>(() => {
314
- return parse(JSON.parse(state[jsonStringKey] as string))
315
- // eslint-disable-next-line react-hooks/exhaustive-deps
316
- }, [state[jsonStringKey], parse])
317
-
318
- const setValue = React.useCallback(
319
- (newValOrFn: TResult | ((prev: TResult) => TResult)) => {
320
- const newVal =
321
- typeof newValOrFn === 'function'
322
- ? // NOTE we're using the ref instead of the value because we want to be sure
323
- // we're using the latest value when the setter is called
324
- (newValOrFn as any)(parse(JSON.parse(componentStateRef.current[jsonStringKey] as string)))
325
- : newValOrFn
326
- setState[jsonStringKey](JSON.stringify(newVal) as any)
327
- },
328
- [parse, jsonStringKey],
329
- )
330
-
331
- return [value, setValue]
332
- }
333
-
334
- return {
335
- state$,
336
- state,
337
- setState,
338
- useLiveStoreJsonState,
339
- }
340
- }
341
-
342
- export type Setters<TComponentState> = {
343
- [k in keyof TComponentState]: (newValue: TComponentState[k]) => void
344
- } & {
345
- setMany: (newValues: Partial<TComponentState>) => void
346
- }
347
-
348
- export const useComponentKey = ({ name, id }: ComponentKeyConfig, deps: DependencyList = []) =>
349
- React.useMemo<ComponentKey>(() => {
350
- switch (id) {
351
- case 'singleton': {
352
- return { _tag: 'singleton', componentName: name, id: 'singleton' }
353
- }
354
- case '__ephemeral__': {
355
- return { _tag: 'ephemeral', componentName: name, id: uuid() }
356
- }
357
- default: {
358
- return { _tag: 'custom', componentName: name, id }
359
- }
360
- }
361
- // eslint-disable-next-line react-hooks/exhaustive-deps
362
- }, [...deps, id, name])
363
-
364
- /**
365
- * Create a row storing the state for a component instance, if none exists yet.
366
- * Initialized with default values, and keyed on the component key.
367
- */
368
- const insertRowForComponentInstance = ({
369
- store,
370
- componentKey,
371
- stateSchema,
372
- otelContext,
373
- }: {
374
- store: Store<BaseGraphQLContext>
375
- componentKey: ComponentKey
376
- stateSchema: SqliteDsl.TableDefinition<string, SqliteDsl.Columns>
377
- otelContext: otel.Context
378
- }) => {
379
- const columnNames = ['id', ...Object.keys(stateSchema.columns)]
380
- const columnValues = columnNames.map((name) => `$${name}`).join(', ')
381
-
382
- const tableName = tableNameForComponentKey(componentKey)
383
- const insertQuery = sql`insert into ${tableName} (${columnNames.join(
384
- ', ',
385
- )}) select ${columnValues} where not exists(select 1 from ${tableName} where id = '${componentKey.id}')`
386
-
387
- void store.execute(
388
- insertQuery,
389
- {
390
- ...mapValues(stateSchema.columns, (column) => prepareValueForSql(column.default ?? null)),
391
- id: componentKey.id,
392
- },
393
- [tableName],
394
- otelContext,
395
- )
396
- }
397
-
398
- const prepareValueForSql = (value: string | number | boolean | null) => {
399
- if (typeof value === 'string' || typeof value === 'number' || value === null) {
400
- return value
401
- } else {
402
- return value ? 1 : 0
403
- }
404
- }
@@ -1,15 +0,0 @@
1
- import type * as otel from '@opentelemetry/api'
2
- import ReactDOM from 'react-dom'
3
-
4
- import { ReactiveGraph } from '../reactive.js'
5
- import type { QueryDebugInfo, RefreshReason, Store } from '../store.js'
6
-
7
- export type DbContext = {
8
- store: Store
9
- otelTracer: otel.Tracer
10
- rootOtelContext: otel.Context
11
- }
12
-
13
- export const dbGraph = new ReactiveGraph<RefreshReason, QueryDebugInfo, DbContext>({
14
- effectsWrapper: (run) => ReactDOM.unstable_batchedUpdates(() => run()),
15
- })