@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/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.js'
10
- import { useRcResource } from './useRcResource.js'
11
- import { originalStackLimit } from './utils/stack-info.js'
12
- import { useStateRefWithReactiveInput } from './utils/useStateRefWithReactiveInput.js'
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.js'
5
- import { LiveStoreContext } from './LiveStoreContext.js'
6
- import { useClientDocument } from './useClientDocument.js'
7
- import { useQuery } from './useQuery.js'
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
- // eslint-disable-next-line react-hooks/rules-of-hooks
11
+
12
12
  store.useQuery = (queryDef) => useQuery(queryDef, { store })
13
13
  // @ts-expect-error TODO properly implement this
14
- // eslint-disable-next-line react-hooks/rules-of-hooks
14
+
15
15
  store.useClientDocument = (table, idOrOptions, options) => useClientDocument(table, idOrOptions, options, { store })
16
16
  return store as Store & ReactApi
17
17
  }
@@ -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
- // eslint-disable-next-line unicorn/error-message
9
+
10
10
  const stack = new Error().stack!
11
11
  Error.stackTraceLimit = originalStackLimit
12
12
  return extractStackInfoFromStackTrace(stack)