@triplit/svelte 0.1.29 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @triplit/svelte
2
2
 
3
+ ## 0.1.31
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [fef88d1]
8
+ - @triplit/client@0.3.59
9
+
10
+ ## 0.1.30
11
+
12
+ ### Patch Changes
13
+
14
+ - 0e4d5d2: fix useQuery hook to work with WorkerClient
15
+ - Updated dependencies [353976a]
16
+ - Updated dependencies [e531de6]
17
+ - @triplit/client@0.3.58
18
+
3
19
  ## 0.1.29
4
20
 
5
21
  ### Patch Changes
@@ -1,12 +1,12 @@
1
- import type { ClientFetchResult, ClientQuery, QueryBuilder, Models, SubscriptionOptions, TriplitClient, Unalias } from '@triplit/client';
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: QueryBuilder<Q>, options?: Partial<SubscriptionOptions>): {
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: QueryBuilder<Q>) => void;
9
+ updateQuery: (query: ClientQueryBuilder<Q>) => void;
10
10
  };
11
11
  export declare function useConnectionStatus(client: TriplitClient<any> | WorkerClient<any>): {
12
12
  readonly status: string;
@@ -15,7 +15,9 @@ export function useQuery(client, query, options) {
15
15
  hasResponseFromServer = false;
16
16
  }
17
17
  $effect(() => {
18
- client.isFirstTimeFetchingQuery(builtQuery).then((isFirstFetch) => {
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.29",
4
+ "version": "0.1.31",
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.57"
31
+ "@triplit/client": "^0.3.59"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@sveltejs/package": "^2.3.0",