@rpcbase/client 0.172.0 → 0.173.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.172.0",
3
+ "version": "0.173.0",
4
4
  "scripts": {
5
5
  "test": "../../node_modules/.bin/wireit"
6
6
  },
@@ -69,7 +69,7 @@ const getUseQuery = (register_query) => (
69
69
  if (options.debug) {
70
70
  console.log("use query", model_name, query, options)
71
71
  }
72
- }, [])
72
+ }, [model_name, query, options])
73
73
 
74
74
  const applyNewData = (newData, context) => {
75
75
  setData(newData)
@@ -99,6 +99,11 @@ const getUseQuery = (register_query) => (
99
99
  useEffect(() => {
100
100
  const queryKey = key || id
101
101
 
102
+ if (!model_name) {
103
+ console.warn("attempting to register query with empty collection, skipping")
104
+ return
105
+ }
106
+
102
107
  if (options.debug ) {
103
108
  console.log("register query", model_name, query, options)
104
109
  }
@@ -165,7 +170,7 @@ const getUseQuery = (register_query) => (
165
170
  }
166
171
 
167
172
  if (isEqual(data, newData) && !isEqualValues(data, newData) && __DEV__) {
168
- alert("EQUALITY MISMATCH THIS SHOULD NOT HAPPPEND!!!", data, newData)
173
+ alert("EQUALITY MISMATCH THIS SHOULD NOT HAPPEN!", data, newData)
169
174
  }
170
175
 
171
176
  if (!isEqualValues(dataRef.current, newData)) {
@@ -187,13 +192,13 @@ const getUseQuery = (register_query) => (
187
192
 
188
193
 
189
194
  const loadNextPage = useCallback(() => {
190
- console.log("will load next page after DOC")
195
+ console.log("NYI: will load next page after DOC")
191
196
  }, [])
192
197
 
193
198
 
194
199
  const result = useMemo(() => ({data, source, error, loading}), [data, source, error, loading])
195
200
 
196
- // TODO: investigate this one
201
+ // TODO:
197
202
  // if (Array.isArray(result.data) && !result.source) {
198
203
  // console.warn("RESULT HAS NO SOURCE", {data, error, loading, source})
199
204
  // }
@@ -22,6 +22,10 @@ const _cols_store = Object.create(null)
22
22
 
23
23
 
24
24
  const get_collection = (col_name) => {
25
+ if (!col_name) {
26
+ console.warn("supplied invalid / empty collection name to rts")
27
+ }
28
+
25
29
  if (_cols_store[col_name]) {
26
30
  return _cols_store[col_name]
27
31
  } else {