@livestore/react 0.3.2-dev.0 → 0.3.2-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/LiveStoreContext.d.ts +2 -2
- package/dist/LiveStoreProvider.js +1 -1
- package/dist/LiveStoreProvider.test.js +5 -8
- package/dist/LiveStoreProvider.test.js.map +1 -1
- package/dist/__tests__/fixture.d.ts +49 -11
- package/dist/__tests__/fixture.d.ts.map +1 -1
- package/dist/experimental/mod.d.ts +1 -1
- package/dist/experimental/mod.js +1 -1
- package/dist/mod.d.ts +6 -6
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +6 -6
- package/dist/mod.js.map +1 -1
- package/dist/useClientDocument.js +2 -2
- package/dist/useClientDocument.test.js +1 -3
- package/dist/useClientDocument.test.js.map +1 -1
- package/dist/useQuery.d.ts.map +1 -1
- package/dist/useQuery.js +4 -5
- package/dist/useQuery.js.map +1 -1
- package/dist/useStore.d.ts +1 -1
- package/dist/useStore.js +3 -5
- package/dist/useStore.js.map +1 -1
- package/dist/utils/stack-info.js +0 -1
- package/dist/utils/stack-info.js.map +1 -1
- package/package.json +8 -22
- package/src/LiveStoreContext.ts +2 -2
- package/src/LiveStoreProvider.test.tsx +5 -17
- package/src/LiveStoreProvider.tsx +1 -1
- package/src/ambient.d.ts +0 -1
- package/src/experimental/mod.ts +1 -1
- package/src/mod.ts +9 -9
- package/src/useClientDocument.test.tsx +1 -7
- package/src/useClientDocument.ts +2 -2
- package/src/useQuery.ts +4 -6
- package/src/useStore.ts +6 -6
- package/src/utils/stack-info.ts +1 -1
package/src/useQuery.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
2
1
|
import type { LiveQuery, LiveQueryDef, Store } from '@livestore/livestore'
|
3
2
|
import { extractStackInfoFromStackTrace, stackInfoToString } from '@livestore/livestore'
|
4
3
|
import type { LiveQueries } from '@livestore/livestore/internal'
|
@@ -6,10 +5,10 @@ import { deepEqual, indent, shouldNeverHappen } from '@livestore/utils'
|
|
6
5
|
import * as otel from '@opentelemetry/api'
|
7
6
|
import React from 'react'
|
8
7
|
|
9
|
-
import { LiveStoreContext } from './LiveStoreContext.
|
10
|
-
import { useRcResource } from './useRcResource.
|
11
|
-
import { originalStackLimit } from './utils/stack-info.
|
12
|
-
import { useStateRefWithReactiveInput } from './utils/useStateRefWithReactiveInput.
|
8
|
+
import { LiveStoreContext } from './LiveStoreContext.ts'
|
9
|
+
import { useRcResource } from './useRcResource.ts'
|
10
|
+
import { originalStackLimit } from './utils/stack-info.ts'
|
11
|
+
import { useStateRefWithReactiveInput } from './utils/useStateRefWithReactiveInput.ts'
|
13
12
|
|
14
13
|
/**
|
15
14
|
* Returns the result of a query and subscribes to future updates.
|
@@ -53,7 +52,6 @@ export const useQueryRef = <TQuery extends LiveQueryDef.Any>(
|
|
53
52
|
|
54
53
|
const stackInfo = React.useMemo(() => {
|
55
54
|
Error.stackTraceLimit = 10
|
56
|
-
// eslint-disable-next-line unicorn/error-message
|
57
55
|
const stack = new Error().stack!
|
58
56
|
Error.stackTraceLimit = originalStackLimit
|
59
57
|
return extractStackInfoFromStackTrace(stack)
|
package/src/useStore.ts
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
import type { Store } from '@livestore/livestore'
|
2
2
|
import React from 'react'
|
3
3
|
|
4
|
-
import type { ReactApi } from './LiveStoreContext.
|
5
|
-
import { LiveStoreContext } from './LiveStoreContext.
|
6
|
-
import { useClientDocument } from './useClientDocument.
|
7
|
-
import { useQuery } from './useQuery.
|
4
|
+
import type { ReactApi } from './LiveStoreContext.ts'
|
5
|
+
import { LiveStoreContext } from './LiveStoreContext.ts'
|
6
|
+
import { useClientDocument } from './useClientDocument.ts'
|
7
|
+
import { useQuery } from './useQuery.ts'
|
8
8
|
|
9
9
|
export const withReactApi = (store: Store): Store & ReactApi => {
|
10
10
|
// @ts-expect-error TODO properly implement this
|
11
|
-
|
11
|
+
|
12
12
|
store.useQuery = (queryDef) => useQuery(queryDef, { store })
|
13
13
|
// @ts-expect-error TODO properly implement this
|
14
|
-
|
14
|
+
|
15
15
|
store.useClientDocument = (table, idOrOptions, options) => useClientDocument(table, idOrOptions, options, { store })
|
16
16
|
return store as Store & ReactApi
|
17
17
|
}
|
package/src/utils/stack-info.ts
CHANGED
@@ -6,7 +6,7 @@ export const originalStackLimit = Error.stackTraceLimit
|
|
6
6
|
export const useStackInfo = (): StackInfo =>
|
7
7
|
React.useMemo(() => {
|
8
8
|
Error.stackTraceLimit = 10
|
9
|
-
|
9
|
+
|
10
10
|
const stack = new Error().stack!
|
11
11
|
Error.stackTraceLimit = originalStackLimit
|
12
12
|
return extractStackInfoFromStackTrace(stack)
|