@livestore/react 0.3.0-dev.9 → 0.3.1-dev.0

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 (97) hide show
  1. package/LICENSE +201 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/LiveStoreContext.d.ts +10 -4
  4. package/dist/LiveStoreContext.d.ts.map +1 -1
  5. package/dist/LiveStoreContext.js +1 -11
  6. package/dist/LiveStoreContext.js.map +1 -1
  7. package/dist/LiveStoreProvider.d.ts +29 -12
  8. package/dist/LiveStoreProvider.d.ts.map +1 -1
  9. package/dist/LiveStoreProvider.js +84 -55
  10. package/dist/LiveStoreProvider.js.map +1 -1
  11. package/dist/LiveStoreProvider.test.js +80 -29
  12. package/dist/LiveStoreProvider.test.js.map +1 -1
  13. package/dist/__tests__/fixture.d.ts +122 -556
  14. package/dist/__tests__/fixture.d.ts.map +1 -1
  15. package/dist/__tests__/fixture.js +71 -30
  16. package/dist/__tests__/fixture.js.map +1 -1
  17. package/dist/experimental/components/LiveList.d.ts +2 -2
  18. package/dist/experimental/components/LiveList.d.ts.map +1 -1
  19. package/dist/experimental/components/LiveList.js +10 -6
  20. package/dist/experimental/components/LiveList.js.map +1 -1
  21. package/dist/mod.d.ts +4 -5
  22. package/dist/mod.d.ts.map +1 -1
  23. package/dist/mod.js +4 -5
  24. package/dist/mod.js.map +1 -1
  25. package/dist/useClientDocument.d.ts +61 -0
  26. package/dist/useClientDocument.d.ts.map +1 -0
  27. package/dist/useClientDocument.js +79 -0
  28. package/dist/useClientDocument.js.map +1 -0
  29. package/dist/useClientDocument.test.d.ts +2 -0
  30. package/dist/useClientDocument.test.d.ts.map +1 -0
  31. package/dist/useClientDocument.test.js +175 -0
  32. package/dist/useClientDocument.test.js.map +1 -0
  33. package/dist/useQuery.d.ts +25 -3
  34. package/dist/useQuery.d.ts.map +1 -1
  35. package/dist/useQuery.js +67 -47
  36. package/dist/useQuery.js.map +1 -1
  37. package/dist/useQuery.test.d.ts +1 -1
  38. package/dist/useQuery.test.d.ts.map +1 -1
  39. package/dist/useQuery.test.js +86 -24
  40. package/dist/useQuery.test.js.map +1 -1
  41. package/dist/useRcResource.d.ts +76 -0
  42. package/dist/useRcResource.d.ts.map +1 -0
  43. package/dist/useRcResource.js +152 -0
  44. package/dist/useRcResource.js.map +1 -0
  45. package/dist/useRcResource.test.d.ts +2 -0
  46. package/dist/useRcResource.test.d.ts.map +1 -0
  47. package/dist/useRcResource.test.js +122 -0
  48. package/dist/useRcResource.test.js.map +1 -0
  49. package/dist/useStore.d.ts +9 -0
  50. package/dist/useStore.d.ts.map +1 -0
  51. package/dist/useStore.js +28 -0
  52. package/dist/useStore.js.map +1 -0
  53. package/dist/utils/useStateRefWithReactiveInput.d.ts.map +1 -1
  54. package/package.json +20 -13
  55. package/src/LiveStoreContext.ts +11 -16
  56. package/src/LiveStoreProvider.test.tsx +176 -37
  57. package/src/LiveStoreProvider.tsx +156 -81
  58. package/src/__snapshots__/useClientDocument.test.tsx.snap +613 -0
  59. package/src/__snapshots__/useQuery.test.tsx.snap +2011 -0
  60. package/src/__tests__/fixture.tsx +74 -47
  61. package/src/experimental/components/LiveList.tsx +10 -7
  62. package/src/mod.ts +5 -6
  63. package/src/useClientDocument.test.tsx +306 -0
  64. package/src/useClientDocument.ts +157 -0
  65. package/src/useQuery.test.tsx +182 -71
  66. package/src/useQuery.ts +95 -58
  67. package/src/useRcResource.test.tsx +167 -0
  68. package/src/useRcResource.ts +182 -0
  69. package/src/useStore.ts +36 -0
  70. package/dist/useAtom.d.ts +0 -5
  71. package/dist/useAtom.d.ts.map +0 -1
  72. package/dist/useAtom.js +0 -38
  73. package/dist/useAtom.js.map +0 -1
  74. package/dist/useRow.d.ts +0 -50
  75. package/dist/useRow.d.ts.map +0 -1
  76. package/dist/useRow.js +0 -93
  77. package/dist/useRow.js.map +0 -1
  78. package/dist/useRow.test.d.ts +0 -2
  79. package/dist/useRow.test.d.ts.map +0 -1
  80. package/dist/useRow.test.js +0 -202
  81. package/dist/useRow.test.js.map +0 -1
  82. package/dist/useScopedQuery.d.ts +0 -33
  83. package/dist/useScopedQuery.d.ts.map +0 -1
  84. package/dist/useScopedQuery.js +0 -87
  85. package/dist/useScopedQuery.js.map +0 -1
  86. package/dist/useScopedQuery.test.d.ts +0 -2
  87. package/dist/useScopedQuery.test.d.ts.map +0 -1
  88. package/dist/useScopedQuery.test.js +0 -60
  89. package/dist/useScopedQuery.test.js.map +0 -1
  90. package/src/__snapshots__/useRow.test.tsx.snap +0 -360
  91. package/src/useAtom.ts +0 -52
  92. package/src/useRow.test.tsx +0 -344
  93. package/src/useRow.ts +0 -188
  94. package/src/useScopedQuery.test.tsx +0 -96
  95. package/src/useScopedQuery.ts +0 -143
  96. package/tsconfig.json +0 -20
  97. package/vitest.config.js +0 -17
@@ -1,202 +0,0 @@
1
- import * as LiveStore from '@livestore/livestore';
2
- import { getSimplifiedRootSpan } from '@livestore/livestore/internal/testing-utils';
3
- import { Effect, ReadonlyRecord, Schema } from '@livestore/utils/effect';
4
- import * as otel from '@opentelemetry/api';
5
- import { BasicTracerProvider, InMemorySpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
6
- import { render, renderHook } from '@testing-library/react';
7
- import React from 'react';
8
- import { describe, expect, it } from 'vitest';
9
- import { AppComponentSchema, AppRouterSchema, makeTodoMvcReact, tables, todos } from './__tests__/fixture.js';
10
- import * as LiveStoreReact from './mod.js';
11
- // const strictMode = process.env.REACT_STRICT_MODE !== undefined
12
- // NOTE running tests concurrently doesn't work with the default global db graph
13
- describe('useRow', () => {
14
- it('should update the data based on component key', () => Effect.gen(function* () {
15
- const { wrapper, store, reactivityGraph, makeRenderCount } = yield* makeTodoMvcReact({
16
- useGlobalReactivityGraph: false,
17
- });
18
- const renderCount = makeRenderCount();
19
- const { result, rerender } = renderHook((userId) => {
20
- renderCount.inc();
21
- const [state, setState] = LiveStoreReact.useRow(AppComponentSchema, userId, { reactivityGraph });
22
- return { state, setState };
23
- }, { wrapper, initialProps: 'u1' });
24
- expect(result.current.state.id).toBe('u1');
25
- expect(result.current.state.username).toBe('');
26
- expect(renderCount.val).toBe(1);
27
- React.act(() => store.mutate(LiveStore.rawSqlMutation({
28
- sql: LiveStore.sql `INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')`,
29
- })));
30
- rerender('u2');
31
- expect(result.current.state.id).toBe('u2');
32
- expect(result.current.state.username).toBe('username_u2');
33
- expect(renderCount.val).toBe(2);
34
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise));
35
- // TODO add a test that makes sure React doesn't re-render when a setter is used to set the same value
36
- it('should update the data reactively - via setState', () => Effect.gen(function* () {
37
- const { wrapper, reactivityGraph, makeRenderCount } = yield* makeTodoMvcReact({
38
- useGlobalReactivityGraph: false,
39
- });
40
- const renderCount = makeRenderCount();
41
- const { result } = renderHook((userId) => {
42
- renderCount.inc();
43
- const [state, setState] = LiveStoreReact.useRow(AppComponentSchema, userId, { reactivityGraph });
44
- return { state, setState };
45
- }, { wrapper, initialProps: 'u1' });
46
- expect(result.current.state.id).toBe('u1');
47
- expect(result.current.state.username).toBe('');
48
- expect(renderCount.val).toBe(1);
49
- React.act(() => result.current.setState.username('username_u1_hello'));
50
- expect(result.current.state.id).toBe('u1');
51
- expect(result.current.state.username).toBe('username_u1_hello');
52
- expect(renderCount.val).toBe(2);
53
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise));
54
- it('should update the data reactively - via raw store mutation', () => Effect.gen(function* () {
55
- const { wrapper, store, reactivityGraph, makeRenderCount } = yield* makeTodoMvcReact({
56
- useGlobalReactivityGraph: false,
57
- });
58
- const renderCount = makeRenderCount();
59
- const { result } = renderHook((userId) => {
60
- renderCount.inc();
61
- const [state, setState] = LiveStoreReact.useRow(AppComponentSchema, userId, { reactivityGraph });
62
- return { state, setState };
63
- }, { wrapper, initialProps: 'u1' });
64
- expect(result.current.state.id).toBe('u1');
65
- expect(result.current.state.username).toBe('');
66
- expect(renderCount.val).toBe(1);
67
- React.act(() => store.mutate(LiveStore.rawSqlMutation({
68
- sql: LiveStore.sql `UPDATE UserInfo SET username = 'username_u1_hello' WHERE id = 'u1';`,
69
- })));
70
- expect(result.current.state.id).toBe('u1');
71
- expect(result.current.state.username).toBe('username_u1_hello');
72
- expect(renderCount.val).toBe(2);
73
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise));
74
- it('should work for a larger app', () => Effect.gen(function* () {
75
- const { wrapper, store, reactivityGraph, makeRenderCount } = yield* makeTodoMvcReact({
76
- useGlobalReactivityGraph: false,
77
- });
78
- const allTodos$ = LiveStore.queryDb({ query: `select * from todos`, schema: Schema.Array(tables.todos.schema) }, { label: 'allTodos', reactivityGraph });
79
- const appRouterRenderCount = makeRenderCount();
80
- let globalSetState;
81
- const AppRouter = () => {
82
- appRouterRenderCount.inc();
83
- const [state, setState] = LiveStoreReact.useRow(AppRouterSchema, { reactivityGraph });
84
- globalSetState = setState;
85
- return (React.createElement("div", null,
86
- React.createElement(TasksList, { setTaskId: setState.currentTaskId }),
87
- React.createElement("div", { role: "current-id" },
88
- "Current Task Id: ",
89
- state.currentTaskId ?? '-'),
90
- state.currentTaskId ? React.createElement(TaskDetails, { id: state.currentTaskId }) : React.createElement("div", null, "Click on a task to see details")));
91
- };
92
- const TasksList = ({ setTaskId }) => {
93
- const allTodos = LiveStoreReact.useQuery(allTodos$);
94
- return (React.createElement("div", null, allTodos.map((_) => (React.createElement("div", { key: _.id, onClick: () => setTaskId(_.id) }, _.id)))));
95
- };
96
- const TaskDetails = ({ id }) => {
97
- const [todo] = LiveStoreReact.useRow(todos, id, { reactivityGraph });
98
- return React.createElement("div", { role: "content" }, JSON.stringify(todo));
99
- };
100
- const renderResult = render(React.createElement(AppRouter, null), { wrapper });
101
- expect(appRouterRenderCount.val).toBe(1);
102
- React.act(() => store.mutate(LiveStore.rawSqlMutation({
103
- sql: LiveStore.sql `INSERT INTO todos (id, text, completed) VALUES ('t1', 'buy milk', 0)`,
104
- })));
105
- expect(appRouterRenderCount.val).toBe(1);
106
- expect(renderResult.getByRole('current-id').innerHTML).toMatchInlineSnapshot('"Current Task Id: -"');
107
- React.act(() => globalSetState.currentTaskId('t1'));
108
- expect(appRouterRenderCount.val).toBe(2);
109
- expect(renderResult.getByRole('content').innerHTML).toMatchInlineSnapshot(`"{"id":"t1","text":"buy milk","completed":false}"`);
110
- expect(renderResult.getByRole('current-id').innerHTML).toMatchInlineSnapshot('"Current Task Id: t1"');
111
- React.act(() => store.mutate(LiveStore.rawSqlMutation({
112
- sql: LiveStore.sql `INSERT INTO todos (id, text, completed) VALUES ('t2', 'buy eggs', 0)`,
113
- }), AppRouterSchema.update({ where: { id: 'singleton' }, values: { currentTaskId: 't2' } }), LiveStore.rawSqlMutation({
114
- sql: LiveStore.sql `INSERT INTO todos (id, text, completed) VALUES ('t3', 'buy bread', 0)`,
115
- })));
116
- expect(appRouterRenderCount.val).toBe(3);
117
- expect(renderResult.getByRole('current-id').innerHTML).toMatchInlineSnapshot('"Current Task Id: t2"');
118
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise));
119
- it('should work for a useRow query chained with a useTemporary query', () => Effect.gen(function* () {
120
- const { store, wrapper, reactivityGraph, makeRenderCount } = yield* makeTodoMvcReact({
121
- useGlobalReactivityGraph: false,
122
- });
123
- const renderCount = makeRenderCount();
124
- store.mutate(todos.insert({ id: 't1', text: 'buy milk', completed: false }), todos.insert({ id: 't2', text: 'buy bread', completed: false }));
125
- const { result, unmount, rerender } = renderHook((userId) => {
126
- renderCount.inc();
127
- const [_row, _setRow, rowState$] = LiveStoreReact.useRow(AppComponentSchema, userId, { reactivityGraph });
128
- const todos = LiveStoreReact.useScopedQuery(() => LiveStore.queryDb((get) => ({
129
- query: LiveStore.sql `select * from todos where text like '%${get(rowState$).text}%'`,
130
- schema: Schema.Array(tables.todos.schema),
131
- }), { reactivityGraph, label: 'todosFiltered' }), userId);
132
- return { todos };
133
- }, { wrapper, initialProps: 'u1' });
134
- React.act(() => store.mutate(LiveStore.rawSqlMutation({
135
- sql: LiveStore.sql `INSERT INTO UserInfo (id, username, text) VALUES ('u2', 'username_u2', 'milk')`,
136
- })));
137
- expect(result.current.todos.length).toBe(2);
138
- // expect(result.current.state.username).toBe('')
139
- expect(renderCount.val).toBe(1);
140
- rerender('u2');
141
- expect(result.current.todos.length).toBe(1);
142
- expect(renderCount.val).toBe(2);
143
- unmount();
144
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise));
145
- describe('otel', () => {
146
- const provider = new BasicTracerProvider({});
147
- provider.register();
148
- it.each([{ strictMode: true }, { strictMode: false }])('should update the data based on component key strictMode=%s', async ({ strictMode }) => {
149
- const exporter = new InMemorySpanExporter();
150
- // const provider = cachedProvider ?? new BasicTracerProvider({ spanProcessors: [new SimpleSpanProcessor(exporter)] })
151
- provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
152
- const otelTracer = otel.trace.getTracer(`testing-${strictMode ? 'strict' : 'non-strict'}`);
153
- const span = otelTracer.startSpan('test-root');
154
- const otelContext = otel.trace.setSpan(otel.context.active(), span);
155
- await Effect.gen(function* () {
156
- const { wrapper, store, reactivityGraph, makeRenderCount } = yield* makeTodoMvcReact({
157
- useGlobalReactivityGraph: false,
158
- otelContext,
159
- otelTracer,
160
- strictMode,
161
- });
162
- const renderCount = makeRenderCount();
163
- const { result, rerender, unmount } = renderHook((userId) => {
164
- renderCount.inc();
165
- const [state, setState] = LiveStoreReact.useRow(AppComponentSchema, userId, { reactivityGraph });
166
- return { state, setState };
167
- }, { wrapper, initialProps: 'u1' });
168
- expect(result.current.state.id).toBe('u1');
169
- expect(result.current.state.username).toBe('');
170
- expect(renderCount.val).toBe(1);
171
- React.act(() => store.mutate(LiveStore.rawSqlMutation({
172
- sql: LiveStore.sql `INSERT INTO UserInfo (id, username) VALUES ('u2', 'username_u2')`,
173
- })));
174
- rerender('u2');
175
- expect(result.current.state.id).toBe('u2');
176
- expect(result.current.state.username).toBe('username_u2');
177
- expect(renderCount.val).toBe(2);
178
- unmount();
179
- span.end();
180
- return { strictMode };
181
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise);
182
- const mapAttributes = (attributes) => {
183
- return ReadonlyRecord.map(attributes, (val, key) => {
184
- if (key === 'stackInfo') {
185
- const stackInfo = JSON.parse(val);
186
- // stackInfo.frames.shift() // Removes `renderHook.wrapper` from the stack
187
- stackInfo.frames.forEach((_) => {
188
- if (_.name.includes('renderHook.wrapper')) {
189
- _.name = 'renderHook.wrapper';
190
- }
191
- _.filePath = '__REPLACED_FOR_SNAPSHOT__';
192
- });
193
- return JSON.stringify(stackInfo);
194
- }
195
- return val;
196
- });
197
- };
198
- expect(getSimplifiedRootSpan(exporter, mapAttributes)).toMatchSnapshot();
199
- });
200
- });
201
- });
202
- //# sourceMappingURL=useRow.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRow.test.js","sourceRoot":"","sources":["../src/useRow.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAC9G,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,w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BACzD,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBAE/B,OAAO,EAAE,CAAA;gBACT,IAAI,CAAC,GAAG,EAAE,CAAA;gBAEV,OAAO,EAAE,UAAU,EAAE,CAAA;YACvB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;YAEnE,MAAM,aAAa,GAAG,CAAC,UAA2B,EAAE,EAAE;gBACpD,OAAO,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;oBACjD,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;wBACxB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAa,CAAwB,CAAA;wBAClE,0EAA0E;wBAC1E,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;gCAC1C,CAAC,CAAC,IAAI,GAAG,oBAAoB,CAAA;4BAC/B,CAAC;4BACD,CAAC,CAAC,QAAQ,GAAG,2BAA2B,CAAA;wBAC1C,CAAC,CAAC,CAAA;wBACF,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;oBAClC,CAAC;oBACD,OAAO,GAAG,CAAA;gBACZ,CAAC,CAAC,CAAA;YACJ,CAAC,CAAA;YAED,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;QAC1E,CAAC,CACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,33 +0,0 @@
1
- import type { QueryInfo } from '@livestore/common';
2
- import type { LiveQuery } from '@livestore/livestore';
3
- import * as otel from '@opentelemetry/api';
4
- import React from 'react';
5
- export type DepKey = string | number | ReadonlyArray<string | number>;
6
- /**
7
- * Creates a query, subscribes and destroys it when the component unmounts.
8
- *
9
- * The `key` is used to determine whether the a new query should be created or if the existing one should be reused.
10
- * This hook should be used instead of `useQuery` when the query should be dynamically created based on some props.
11
- * Otherwise when using `useQuery` the query will be leaked (i.e. never destroyed) when the component re-renders/unmounts.
12
- *
13
- * Example:
14
- * ```tsx
15
- * const issue = useScopedQuery(() => queryDb(tables.issues.query.where('id', issueId).first()), ['issue-details', issueId])
16
- * ```
17
- *
18
- * Important: On Expo/React Native please make sure the key contains a globally unique identifier, otherwise the query might get reused unintentionally.
19
- * Example: `['issue-details', issueId]`
20
- * See this issue to track progress: https://github.com/livestorejs/livestore/issues/231
21
- */
22
- export declare const useScopedQuery: <TResult>(makeQuery: () => LiveQuery<TResult>, key: DepKey) => TResult;
23
- export declare const useScopedQueryRef: <TResult>(makeQuery: () => LiveQuery<TResult>, key: DepKey) => React.RefObject<TResult>;
24
- export declare const useMakeScopedQuery: <TResult, TQueryInfo extends QueryInfo>(makeQuery: (otelContext: otel.Context) => LiveQuery<TResult, TQueryInfo>, key: DepKey, options?: {
25
- otel?: {
26
- spanName?: string;
27
- attributes?: otel.Attributes;
28
- };
29
- }) => {
30
- query$: LiveQuery<TResult, TQueryInfo>;
31
- otelContext: otel.Context;
32
- };
33
- //# sourceMappingURL=useScopedQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScopedQuery.d.ts","sourceRoot":"","sources":["../src/useScopedQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAA;AAuBzB,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAErE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,aAAa,MAAM,SAAS,CAAC,OAAO,CAAC,OAAO,MAAM,KAAG,OAChD,CAAA;AAE3C,eAAO,MAAM,iBAAiB,GAAI,OAAO,aAC5B,MAAM,SAAS,CAAC,OAAO,CAAC,OAC9B,MAAM,KACV,KAAK,CAAC,SAAS,CAAC,OAAO,CAIzB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,EAAE,UAAU,SAAS,SAAS,aAC3D,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,OACnE,MAAM,YACD;IACR,IAAI,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,CAAA;KAC7B,CAAA;CACF,KACA;IAAE,MAAM,EAAE,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAA;CA6ErE,CAAA"}
@@ -1,87 +0,0 @@
1
- import * as otel from '@opentelemetry/api';
2
- import React from 'react';
3
- import { useStore } from './LiveStoreContext.js';
4
- import { useQueryRef } from './useQuery.js';
5
- // NOTE Given `useMemo` will be called multiple times (e.g. when using React Strict mode or Fast Refresh),
6
- // we are using this cache to avoid starting multiple queries/spans for the same component.
7
- // This is somewhat against some recommended React best practices, but it should be fine in our case below.
8
- // Please definitely open an issue if you see or run into any problems with this approach!
9
- const cache = new Map();
10
- /**
11
- * Creates a query, subscribes and destroys it when the component unmounts.
12
- *
13
- * The `key` is used to determine whether the a new query should be created or if the existing one should be reused.
14
- * This hook should be used instead of `useQuery` when the query should be dynamically created based on some props.
15
- * Otherwise when using `useQuery` the query will be leaked (i.e. never destroyed) when the component re-renders/unmounts.
16
- *
17
- * Example:
18
- * ```tsx
19
- * const issue = useScopedQuery(() => queryDb(tables.issues.query.where('id', issueId).first()), ['issue-details', issueId])
20
- * ```
21
- *
22
- * Important: On Expo/React Native please make sure the key contains a globally unique identifier, otherwise the query might get reused unintentionally.
23
- * Example: `['issue-details', issueId]`
24
- * See this issue to track progress: https://github.com/livestorejs/livestore/issues/231
25
- */
26
- export const useScopedQuery = (makeQuery, key) => useScopedQueryRef(makeQuery, key).current;
27
- export const useScopedQueryRef = (makeQuery, key) => {
28
- const { query$ } = useMakeScopedQuery(makeQuery, key);
29
- return useQueryRef(query$);
30
- };
31
- export const useMakeScopedQuery = (makeQuery, key, options) => {
32
- const { store } = useStore();
33
- const fullKey = React.useMemo(
34
- // NOTE We're using the `makeQuery` function body string to make sure the key is unique across the app
35
- // TODO we should figure out whether this could cause some problems and/or if there's a better way to do this
36
- () => (Array.isArray(key) ? key.join('-') : key) + '-' + store.reactivityGraph.id + '-' + makeQuery.toString(), [key, makeQuery, store.reactivityGraph.id]);
37
- const fullKeyRef = React.useRef(undefined);
38
- const { query$, otelContext } = React.useMemo(() => {
39
- if (fullKeyRef.current !== undefined && fullKeyRef.current !== fullKey) {
40
- // console.debug('fullKey changed', 'prev', fullKeyRef.current.split('-')[0]!, '-> new', fullKey.split('-')[0]!)
41
- const cachedItem = cache.get(fullKeyRef.current);
42
- if (cachedItem !== undefined && cachedItem._tag === 'active') {
43
- cachedItem.rc--;
44
- if (cachedItem.rc === 0) {
45
- // console.debug('rc=0-changed', cachedItem.query$.id, cachedItem.query$.label)
46
- cachedItem.query$.destroy();
47
- cachedItem.span.end();
48
- cache.set(fullKeyRef.current, { _tag: 'destroyed' });
49
- }
50
- }
51
- }
52
- const cachedItem = cache.get(fullKey);
53
- if (cachedItem !== undefined && cachedItem._tag === 'active') {
54
- // console.debug('rc++', cachedItem.query$.id, cachedItem.query$.label)
55
- cachedItem.rc++;
56
- return cachedItem;
57
- }
58
- const spanName = options?.otel?.spanName ?? `LiveStore:useScopedQuery:${key}`;
59
- const span = store.otel.tracer.startSpan(spanName, { attributes: options?.otel?.attributes }, store.otel.queriesSpanContext);
60
- const otelContext = otel.trace.setSpan(otel.context.active(), span);
61
- // console.debug('useScopedQuery:startSpan', fullKey, spanName)
62
- const query$ = makeQuery(otelContext);
63
- cache.set(fullKey, { _tag: 'active', rc: 1, query$, span, otelContext });
64
- return { query$, otelContext };
65
- // eslint-disable-next-line react-hooks/exhaustive-deps
66
- }, [fullKey]);
67
- fullKeyRef.current = fullKey;
68
- React.useEffect(() => {
69
- return () => {
70
- const fullKey = fullKeyRef.current;
71
- const cachedItem = cache.get(fullKey);
72
- // NOTE in case the fullKey changed then the query was already destroyed in the useMemo above
73
- if (cachedItem === undefined || cachedItem._tag === 'destroyed')
74
- return;
75
- // console.debug('rc--', cachedItem.query$.id, cachedItem.query$.label)
76
- cachedItem.rc--;
77
- if (cachedItem.rc === 0) {
78
- // console.debug('rc=0', cachedItem.query$.id, cachedItem.query$.label)
79
- cachedItem.query$.destroy();
80
- cachedItem.span.end();
81
- cache.delete(fullKey);
82
- }
83
- };
84
- }, []);
85
- return { query$, otelContext };
86
- };
87
- //# sourceMappingURL=useScopedQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScopedQuery.js","sourceRoot":"","sources":["../src/useScopedQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,0GAA0G;AAC1G,2FAA2F;AAC3F,2GAA2G;AAC3G,0FAA0F;AAC1F,MAAM,KAAK,GAAG,IAAI,GAAG,EAYlB,CAAA;AAIH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAU,SAAmC,EAAE,GAAW,EAAW,EAAE,CACnG,iBAAiB,CAAC,SAAS,EAAE,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zD,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEb,UAAU,CAAC,OAAO,GAAG,OAAO,CAAA;IAE5B,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,GAAG,EAAE;YACV,MAAM,OAAO,GAAG,UAAU,CAAC,OAAQ,CAAA;YACnC,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACrC,6FAA6F;YAC7F,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,KAAK,WAAW;gBAAE,OAAM;YAEvE,uEAAuE;YAEvE,UAAU,CAAC,EAAE,EAAE,CAAA;YAEf,IAAI,UAAU,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;gBACxB,uEAAuE;gBACvE,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;gBAC3B,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;gBACrB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YACvB,CAAC;QACH,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAA;AAChC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useScopedQuery.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScopedQuery.test.d.ts","sourceRoot":"","sources":["../src/useScopedQuery.test.tsx"],"names":[],"mappings":""}
@@ -1,60 +0,0 @@
1
- import * as LiveStore from '@livestore/livestore';
2
- import { queryDb } from '@livestore/livestore';
3
- import { Effect, Schema } from '@livestore/utils/effect';
4
- import { render, renderHook } from '@testing-library/react';
5
- import React from 'react';
6
- // @ts-expect-error no types
7
- import * as ReactWindow from 'react-window';
8
- import { describe, expect, it } from 'vitest';
9
- import { makeTodoMvcReact, tables, todos } from './__tests__/fixture.js';
10
- import * as LiveStoreReact from './mod.js';
11
- describe('useScopedQuery', () => {
12
- it('simple', () => Effect.gen(function* () {
13
- const { wrapper, store, makeRenderCount } = yield* makeTodoMvcReact();
14
- const renderCount = makeRenderCount();
15
- store.mutate(todos.insert({ id: 't1', text: 'buy milk', completed: false }), todos.insert({ id: 't2', text: 'buy bread', completed: false }));
16
- const queryMap = new Map();
17
- const { rerender, result, unmount } = renderHook((id) => {
18
- renderCount.inc();
19
- return LiveStoreReact.useScopedQuery(() => {
20
- const query$ = queryDb({
21
- query: `select * from todos where id = '${id}'`,
22
- schema: Schema.Array(tables.todos.schema),
23
- });
24
- queryMap.set(id, query$);
25
- return query$;
26
- }, id);
27
- }, { wrapper, initialProps: 't1' });
28
- expect(result.current.length).toBe(1);
29
- expect(result.current[0].text).toBe('buy milk');
30
- expect(renderCount.val).toBe(1);
31
- expect(queryMap.get('t1').runs).toBe(1);
32
- rerender('t2');
33
- expect(result.current.length).toBe(1);
34
- expect(result.current[0].text).toBe('buy bread');
35
- expect(renderCount.val).toBe(2);
36
- expect(queryMap.get('t1').runs).toBe(1);
37
- expect(queryMap.get('t2').runs).toBe(1);
38
- unmount();
39
- expect(queryMap.get('t2').runs).toBe(1);
40
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise));
41
- // NOTE this test covers some special react lifecyle paths which I couldn't easily reproduce without react-window
42
- // it basically causes a "query swap" in the `useMemo` and both a `useEffect` cleanup call.
43
- // To handle this properly we introduced the `_tag: 'destroyed'` state in the `spanAlreadyStartedCache`.
44
- it('should work for a list with react-window', () => Effect.gen(function* () {
45
- const { wrapper } = yield* makeTodoMvcReact();
46
- const ListWrapper = ({ numItems }) => {
47
- return (React.createElement(ReactWindow.FixedSizeList, { height: 100, width: 100, itemSize: 10, itemCount: numItems, itemData: Array.from({ length: numItems }, (_, i) => i).reverse() }, ListItem));
48
- };
49
- const ListItem = ({ data: ids, index }) => {
50
- const id = ids[index];
51
- const res = LiveStoreReact.useScopedQuery(() => LiveStore.computed(() => id, { label: `ListItem.${id}` }), id);
52
- return React.createElement("div", { role: "listitem" }, res);
53
- };
54
- const renderResult = render(React.createElement(ListWrapper, { numItems: 1 }), { wrapper });
55
- expect(renderResult.container.textContent).toBe('0');
56
- renderResult.rerender(React.createElement(ListWrapper, { numItems: 2 }));
57
- expect(renderResult.container.textContent).toBe('10');
58
- }).pipe(Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise));
59
- });
60
- //# sourceMappingURL=useScopedQuery.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScopedQuery.test.js","sourceRoot":"","sources":["../src/useScopedQuery.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,4BAA4B;AAC5B,OAAO,KAAK,WAAW,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,KAAK,cAAc,MAAM,UAAU,CAAA;AAE1C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAChB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAA;QAErE,MAAM,WAAW,GAAG,eAAe,EAAE,CAAA;QAErC,KAAK,CAAC,MAAM,CACV,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EA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