@triplit/svelte 0.1.22 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -0
- package/dist/index.svelte.d.ts +3 -2
- package/dist/index.svelte.js +4 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# @triplit/svelte
|
2
2
|
|
3
|
+
## 0.1.24
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [d890707]
|
8
|
+
- @triplit/client@0.3.52
|
9
|
+
|
10
|
+
## 0.1.23
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- 19e147e: update query hook types to accept WorkerClient
|
15
|
+
- Updated dependencies [19e147e]
|
16
|
+
- @triplit/client@0.3.51
|
17
|
+
|
3
18
|
## 0.1.22
|
4
19
|
|
5
20
|
### Patch Changes
|
package/dist/index.svelte.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ClientFetchResult, ClientQuery, QueryBuilder, Models, SubscriptionOptions, TriplitClient } from '@triplit/client';
|
2
|
-
|
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
|
};
|
package/dist/index.svelte.js
CHANGED
@@ -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.
|
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.
|
19
|
-
.isFirstTimeFetchingQuery(builtQuery)
|
20
|
-
.then((isFirstFetch) => {
|
18
|
+
client.isFirstTimeFetchingQuery(builtQuery).then((isFirstFetch) => {
|
21
19
|
isInitialFetch = isFirstFetch;
|
22
20
|
});
|
23
|
-
const unsub = client.
|
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.
|
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.
|
4
|
+
"version": "0.1.24",
|
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.
|
30
|
+
"@triplit/client": "^0.3.52"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
33
|
"@sveltejs/package": "^2.3.0",
|