@triplit/react 0.0.27 → 0.0.29
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/CHANGELOG.md +11 -0
- package/dist/index.js +1 -1
- package/dist/use-query.js +25 -0
- package/package.json +4 -6
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# @triplit/react
|
2
2
|
|
3
|
+
## 0.0.28
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 5011219: - add string comparison operations
|
8
|
+
- add fetchById method
|
9
|
+
- support cursor pagination
|
10
|
+
- performance improvements and bug fixes
|
11
|
+
- Updated dependencies [5011219]
|
12
|
+
- @triplit/client@0.0.28
|
13
|
+
|
3
14
|
## 0.0.27
|
4
15
|
|
5
16
|
### Patch Changes
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export * from './use-query';
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useEffect, useState } from 'react';
|
2
|
+
export function useQuery(client, query) {
|
3
|
+
const [results, setResults] = useState(undefined);
|
4
|
+
const [fetchingLocal, setFetchingLocal] = useState(false);
|
5
|
+
// const [fetchingRemote, setFetchingRemote] = useState(false);
|
6
|
+
const builtQuery = query.build();
|
7
|
+
const stringifiedQuery = JSON.stringify(builtQuery);
|
8
|
+
useEffect(() => {
|
9
|
+
setResults(undefined);
|
10
|
+
setFetchingLocal(true);
|
11
|
+
const unsubscribe = client.subscribe(builtQuery, (localResults) => {
|
12
|
+
setFetchingLocal(false);
|
13
|
+
setResults(localResults);
|
14
|
+
});
|
15
|
+
return () => {
|
16
|
+
unsubscribe();
|
17
|
+
};
|
18
|
+
}, [stringifiedQuery, client]);
|
19
|
+
return {
|
20
|
+
fetchingLocal,
|
21
|
+
// fetchingRemote,
|
22
|
+
results,
|
23
|
+
error: null,
|
24
|
+
};
|
25
|
+
}
|
package/package.json
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "@triplit/react",
|
3
3
|
"packageManager": "yarn@3.4.1",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.29",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"typings": "dist/index.d.ts",
|
7
7
|
"type": "module",
|
8
8
|
"scripts": {
|
9
|
-
"build": "
|
10
|
-
"build:code": "node build.cjs",
|
11
|
-
"build:types": "tsc --noEmit false --emitDeclarationOnly --declaration --baseUrl . --outDir dist",
|
9
|
+
"build": "tsc --noEmit false --declaration --baseUrl . --paths null --outDir dist",
|
12
10
|
"lint": "tsc",
|
13
|
-
"publish-pkg": "
|
11
|
+
"publish-pkg": "node ../../scripts/npm-check-version-and-publish.js"
|
14
12
|
},
|
15
13
|
"files": [
|
16
14
|
"/dist"
|
17
15
|
],
|
18
16
|
"dependencies": {
|
19
|
-
"@triplit/client": "^0.0.
|
17
|
+
"@triplit/client": "^0.0.29"
|
20
18
|
},
|
21
19
|
"devDependencies": {
|
22
20
|
"@types/react": "^18.2.0",
|