@rpcbase/client 0.62.0 → 0.63.0
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/package.json +1 -1
- package/rts/getUseQuery.js +17 -21
package/package.json
CHANGED
package/rts/getUseQuery.js
CHANGED
|
@@ -8,7 +8,7 @@ import _omit from "lodash/omit"
|
|
|
8
8
|
|
|
9
9
|
import get_uid from "../auth/get_uid"
|
|
10
10
|
|
|
11
|
-
import cacheStorage from "./cacheStorage"
|
|
11
|
+
// import cacheStorage from "./cacheStorage"
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
const log = debug("rb:rts:useQuery")
|
|
@@ -45,7 +45,7 @@ const getUseQuery = (register_query) => (
|
|
|
45
45
|
sort = {},
|
|
46
46
|
} = options
|
|
47
47
|
|
|
48
|
-
const storageKey = `${uid}.${key}.${model_name}.${JSON.stringify(query)}.${JSON.stringify(projection)}.${JSON.stringify(sort)}`
|
|
48
|
+
// const storageKey = `${uid}.${key}.${model_name}.${JSON.stringify(query)}.${JSON.stringify(projection)}.${JSON.stringify(sort)}`
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
if (options.debug) {
|
|
@@ -53,27 +53,23 @@ const getUseQuery = (register_query) => (
|
|
|
53
53
|
}
|
|
54
54
|
}, [])
|
|
55
55
|
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [storageKey])
|
|
56
|
+
// useEffect(() => {
|
|
57
|
+
// const load = async() => {
|
|
58
|
+
// const val = await cacheStorage.get(storageKey)
|
|
59
|
+
// // TODO: rm this
|
|
60
|
+
// // always initially apply when first load here
|
|
61
|
+
// if (val) {
|
|
62
|
+
// console.log("Will set val from cache storage")
|
|
63
|
+
// setData(val)
|
|
64
|
+
// setLoading(false)
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
//
|
|
68
|
+
// load()
|
|
69
|
+
// }, [storageKey])
|
|
70
70
|
|
|
71
71
|
const applyNewData = (newData, context) => {
|
|
72
72
|
setData(newData)
|
|
73
|
-
// write data to storage
|
|
74
|
-
// TODO: is there a better way than doing it on every update ?
|
|
75
|
-
// should this be throttled
|
|
76
|
-
cacheStorage.set(storageKey, newData)
|
|
77
73
|
|
|
78
74
|
if (newData?.length > 0) {
|
|
79
75
|
lastDocRef.current = newData[newData.length - 1]
|
|
@@ -161,7 +157,7 @@ const getUseQuery = (register_query) => (
|
|
|
161
157
|
log && log("useQuery cleanup unsubscribe()")
|
|
162
158
|
unsubscribe()
|
|
163
159
|
}
|
|
164
|
-
}, [JSON.stringify(query), key
|
|
160
|
+
}, [JSON.stringify(query), key])
|
|
165
161
|
|
|
166
162
|
|
|
167
163
|
const loadNextPage = useCallback(() => {
|