@triplit/svelte 0.1.21 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @triplit/svelte
2
2
 
3
+ ## 0.1.23
4
+
5
+ ### Patch Changes
6
+
7
+ - 19e147e: update query hook types to accept WorkerClient
8
+ - Updated dependencies [19e147e]
9
+ - @triplit/client@0.3.51
10
+
11
+ ## 0.1.22
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [3f633a1]
16
+ - @triplit/client@0.3.50
17
+
3
18
  ## 0.1.21
4
19
 
5
20
  ### Patch Changes
@@ -1,5 +1,6 @@
1
1
  import type { ClientFetchResult, ClientQuery, QueryBuilder, Models, SubscriptionOptions, TriplitClient } from '@triplit/client';
2
- export declare function useQuery<M extends Models<any, any> | undefined, Q extends ClientQuery<M, any, any, any>>(client: TriplitClient<any>, query: QueryBuilder<Q>, options?: Partial<SubscriptionOptions>): {
2
+ import { WorkerClient } from '@triplit/client/worker-client';
3
+ export declare function useQuery<M extends Models<any, any> | undefined, Q extends ClientQuery<M, any, any, any>>(client: TriplitClient<any> | WorkerClient<any>, query: QueryBuilder<Q>, options?: Partial<SubscriptionOptions>): {
3
4
  fetching: boolean;
4
5
  fetchingLocal: boolean;
5
6
  fetchingRemote: boolean;
@@ -7,6 +8,6 @@ export declare function useQuery<M extends Models<any, any> | undefined, Q exten
7
8
  error: any;
8
9
  updateQuery: (query: QueryBuilder<Q>) => void;
9
10
  };
10
- export declare function useConnectionStatus(client: TriplitClient<any>): {
11
+ export declare function useConnectionStatus(client: TriplitClient<any> | WorkerClient<any>): {
11
12
  readonly status: string;
12
13
  };
@@ -3,7 +3,7 @@ export function useQuery(client, query, options) {
3
3
  let results = $state(undefined);
4
4
  let isInitialFetch = $state(true);
5
5
  let fetchingLocal = $state(false);
6
- let fetchingRemote = $state(client.syncEngine.connectionStatus !== 'CLOSED');
6
+ let fetchingRemote = $state(client.connectionStatus !== 'CLOSED');
7
7
  let fetching = $derived(fetchingLocal || (isInitialFetch && fetchingRemote));
8
8
  let error = $state(undefined);
9
9
  let hasResponseFromServer = false;
@@ -15,12 +15,10 @@ export function useQuery(client, query, options) {
15
15
  hasResponseFromServer = false;
16
16
  }
17
17
  $effect(() => {
18
- client.syncEngine
19
- .isFirstTimeFetchingQuery(builtQuery)
20
- .then((isFirstFetch) => {
18
+ client.isFirstTimeFetchingQuery(builtQuery).then((isFirstFetch) => {
21
19
  isInitialFetch = isFirstFetch;
22
20
  });
23
- const unsub = client.syncEngine.onConnectionStatusChange((status) => {
21
+ const unsub = client.onConnectionStatusChange((status) => {
24
22
  if (status === 'CLOSING' || status === 'CLOSED') {
25
23
  fetchingRemote = false;
26
24
  return;
@@ -75,7 +73,7 @@ export function useQuery(client, query, options) {
75
73
  export function useConnectionStatus(client) {
76
74
  let status = $state('CONNECTING');
77
75
  $effect(() => {
78
- const unsub = client.syncEngine.onConnectionStatusChange((newStatus) => {
76
+ const unsub = client.onConnectionStatusChange((newStatus) => {
79
77
  status = newStatus;
80
78
  }, true);
81
79
  return () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@triplit/svelte",
3
3
  "packageManager": "yarn@3.4.1",
4
- "version": "0.1.21",
4
+ "version": "0.1.23",
5
5
  "source": "./src/index.svelte.ts",
6
6
  "main": "./dist/index.svelte.js",
7
7
  "module": "./dist/index.svelte.js",
@@ -27,7 +27,7 @@
27
27
  "/dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@triplit/client": "^0.3.49"
30
+ "@triplit/client": "^0.3.51"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@sveltejs/package": "^2.3.0",