@triplit/svelte 0.1.29 → 0.1.30
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -0
- package/dist/index.svelte.d.ts +3 -3
- package/dist/index.svelte.js +4 -2
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
package/dist/index.svelte.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import type { ClientFetchResult, ClientQuery,
|
1
|
+
import type { ClientFetchResult, ClientQuery, ClientQueryBuilder, Models, SubscriptionOptions, TriplitClient, Unalias } 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:
|
3
|
+
export declare function useQuery<M extends Models<any, any> | undefined, Q extends ClientQuery<M, any, any, any>>(client: TriplitClient<any> | WorkerClient<any>, query: ClientQueryBuilder<Q>, options?: Partial<SubscriptionOptions>): {
|
4
4
|
fetching: boolean;
|
5
5
|
fetchingLocal: boolean;
|
6
6
|
fetchingRemote: boolean;
|
7
7
|
results: Unalias<ClientFetchResult<Q>> | undefined;
|
8
8
|
error: any;
|
9
|
-
updateQuery: (query:
|
9
|
+
updateQuery: (query: ClientQueryBuilder<Q>) => void;
|
10
10
|
};
|
11
11
|
export declare function useConnectionStatus(client: TriplitClient<any> | WorkerClient<any>): {
|
12
12
|
readonly status: string;
|
package/dist/index.svelte.js
CHANGED
@@ -15,7 +15,9 @@ export function useQuery(client, query, options) {
|
|
15
15
|
hasResponseFromServer = false;
|
16
16
|
}
|
17
17
|
$effect(() => {
|
18
|
-
client
|
18
|
+
client
|
19
|
+
.isFirstTimeFetchingQuery($state.snapshot(builtQuery))
|
20
|
+
.then((isFirstFetch) => {
|
19
21
|
isInitialFetch = isFirstFetch;
|
20
22
|
});
|
21
23
|
const unsub = client.onConnectionStatusChange((status) => {
|
@@ -33,7 +35,7 @@ export function useQuery(client, query, options) {
|
|
33
35
|
};
|
34
36
|
});
|
35
37
|
$effect(() => {
|
36
|
-
const unsubscribe = client.subscribe(builtQuery, (localResults) => {
|
38
|
+
const unsubscribe = client.subscribe($state.snapshot(builtQuery), (localResults) => {
|
37
39
|
fetchingLocal = false;
|
38
40
|
error = undefined;
|
39
41
|
results = new Map(localResults);
|
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.30",
|
5
5
|
"source": "./src/index.svelte.ts",
|
6
6
|
"main": "./dist/index.svelte.js",
|
7
7
|
"module": "./dist/index.svelte.js",
|
@@ -17,17 +17,18 @@
|
|
17
17
|
}
|
18
18
|
},
|
19
19
|
"scripts": {
|
20
|
-
"build": "svelte-package -t=false && tsc",
|
20
|
+
"build": "svelte-package -t=false && tsc && yarn validate:types",
|
21
21
|
"build:watch": "svelte-package -w",
|
22
22
|
"lint:build": "npx publint",
|
23
23
|
"publish-pkg": "node ../../scripts/npm-check-version-and-publish.js",
|
24
|
-
"check": "svelte-check --tsconfig ./tsconfig.json"
|
24
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
25
|
+
"validate:types": "node ../../scripts/check-for-local-references-in-declarations.js dist"
|
25
26
|
},
|
26
27
|
"files": [
|
27
28
|
"/dist"
|
28
29
|
],
|
29
30
|
"dependencies": {
|
30
|
-
"@triplit/client": "^0.3.
|
31
|
+
"@triplit/client": "^0.3.58"
|
31
32
|
},
|
32
33
|
"devDependencies": {
|
33
34
|
"@sveltejs/package": "^2.3.0",
|