qortex-react 0.1.6 → 0.1.7
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/index.js +4 -4
- package/index.mjs +6 -6
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -33,10 +33,10 @@ var import_qortex_core = require("qortex-core");
|
|
|
33
33
|
function useQuery(key, opts) {
|
|
34
34
|
const serializedKey = (0, import_qortex_core.serializeKey)(key);
|
|
35
35
|
const getSnapshot = (0, import_react.useCallback)(() => {
|
|
36
|
-
return import_qortex_core.
|
|
36
|
+
return (0, import_qortex_core.getQueryState)(key, opts);
|
|
37
37
|
}, [serializedKey]);
|
|
38
38
|
const subscribe = (0, import_react.useCallback)((callback) => {
|
|
39
|
-
return import_qortex_core.
|
|
39
|
+
return (0, import_qortex_core.subscribeQuery)(key, callback, opts);
|
|
40
40
|
}, [serializedKey]);
|
|
41
41
|
const state = (0, import_react.useSyncExternalStore)(
|
|
42
42
|
subscribe,
|
|
@@ -51,10 +51,10 @@ var import_qortex_core2 = require("qortex-core");
|
|
|
51
51
|
function useQueryData(key, opts) {
|
|
52
52
|
const serializedKey = (0, import_qortex_core2.serializeKey)(key);
|
|
53
53
|
const getSnapshot = (0, import_react2.useCallback)(() => {
|
|
54
|
-
return import_qortex_core2.
|
|
54
|
+
return (0, import_qortex_core2.getQueryData)(key, opts);
|
|
55
55
|
}, [serializedKey]);
|
|
56
56
|
const subscribe = (0, import_react2.useCallback)((callback) => {
|
|
57
|
-
return import_qortex_core2.
|
|
57
|
+
return (0, import_qortex_core2.subscribeQuery)(key, callback, opts);
|
|
58
58
|
}, [serializedKey]);
|
|
59
59
|
const data = (0, import_react2.useSyncExternalStore)(
|
|
60
60
|
subscribe,
|
package/index.mjs
CHANGED
|
@@ -3,14 +3,14 @@ export * from "qortex-core";
|
|
|
3
3
|
|
|
4
4
|
// src/useQuery.tsx
|
|
5
5
|
import { useSyncExternalStore, useCallback } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { subscribeQuery, getQueryState, serializeKey } from "qortex-core";
|
|
7
7
|
function useQuery(key, opts) {
|
|
8
8
|
const serializedKey = serializeKey(key);
|
|
9
9
|
const getSnapshot = useCallback(() => {
|
|
10
|
-
return
|
|
10
|
+
return getQueryState(key, opts);
|
|
11
11
|
}, [serializedKey]);
|
|
12
12
|
const subscribe = useCallback((callback) => {
|
|
13
|
-
return
|
|
13
|
+
return subscribeQuery(key, callback, opts);
|
|
14
14
|
}, [serializedKey]);
|
|
15
15
|
const state = useSyncExternalStore(
|
|
16
16
|
subscribe,
|
|
@@ -21,14 +21,14 @@ function useQuery(key, opts) {
|
|
|
21
21
|
|
|
22
22
|
// src/useQueryData.tsx
|
|
23
23
|
import { useSyncExternalStore as useSyncExternalStore2, useCallback as useCallback2 } from "react";
|
|
24
|
-
import {
|
|
24
|
+
import { getQueryData, subscribeQuery as subscribeQuery2, serializeKey as serializeKey2 } from "qortex-core";
|
|
25
25
|
function useQueryData(key, opts) {
|
|
26
26
|
const serializedKey = serializeKey2(key);
|
|
27
27
|
const getSnapshot = useCallback2(() => {
|
|
28
|
-
return
|
|
28
|
+
return getQueryData(key, opts);
|
|
29
29
|
}, [serializedKey]);
|
|
30
30
|
const subscribe = useCallback2((callback) => {
|
|
31
|
-
return
|
|
31
|
+
return subscribeQuery2(key, callback, opts);
|
|
32
32
|
}, [serializedKey]);
|
|
33
33
|
const data = useSyncExternalStore2(
|
|
34
34
|
subscribe,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qortex-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "React hook bridge for qortex runtime",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"author": "Darshan Naik",
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"qortex-core": "0.1.
|
|
45
|
+
"qortex-core": "0.1.7"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=18"
|