tinybase 8.2.0-beta.2 → 8.3.0-beta.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/@types/ui-react-dom/index.d.ts +10 -14
- package/@types/ui-react-dom/with-schemas/index.d.ts +10 -14
- package/@types/ui-react-inspector/index.d.ts +1 -1
- package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-svelte-dom/index.d.ts +10 -14
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -14
- package/@types/ui-svelte-inspector/index.d.ts +1 -1
- package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
- package/package.json +3 -3
- package/readme.md +14 -14
- package/releases.md +51 -50
- package/ui-react/index.js +7 -4
- package/ui-react/with-schemas/index.js +7 -4
- package/ui-react-dom/index.js +7 -4
- package/ui-react-dom/with-schemas/index.js +7 -4
- package/ui-react-inspector/index.js +7 -4
- package/ui-react-inspector/with-schemas/index.js +7 -4
package/ui-react/index.js
CHANGED
|
@@ -384,16 +384,19 @@ const addAndDelListener = (thing, listenable, ...args) => {
|
|
|
384
384
|
return () => thing?.delListener?.(listenerId);
|
|
385
385
|
};
|
|
386
386
|
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
387
|
-
const
|
|
387
|
+
const lastResultRef = useRef(DEFAULTS[returnType]);
|
|
388
388
|
const getResult = useCallback(
|
|
389
389
|
() => {
|
|
390
390
|
const nextResult =
|
|
391
391
|
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
392
392
|
...args,
|
|
393
393
|
) ?? DEFAULTS[returnType];
|
|
394
|
-
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
395
|
+
nextResult,
|
|
396
|
+
lastResultRef.current,
|
|
397
|
+
)
|
|
398
|
+
? (lastResultRef.current = nextResult)
|
|
399
|
+
: lastResultRef.current;
|
|
397
400
|
},
|
|
398
401
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
399
402
|
[thing, returnType, listenable, ...args],
|
|
@@ -384,16 +384,19 @@ const addAndDelListener = (thing, listenable, ...args) => {
|
|
|
384
384
|
return () => thing?.delListener?.(listenerId);
|
|
385
385
|
};
|
|
386
386
|
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
387
|
-
const
|
|
387
|
+
const lastResultRef = useRef(DEFAULTS[returnType]);
|
|
388
388
|
const getResult = useCallback(
|
|
389
389
|
() => {
|
|
390
390
|
const nextResult =
|
|
391
391
|
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
392
392
|
...args,
|
|
393
393
|
) ?? DEFAULTS[returnType];
|
|
394
|
-
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
395
|
+
nextResult,
|
|
396
|
+
lastResultRef.current,
|
|
397
|
+
)
|
|
398
|
+
? (lastResultRef.current = nextResult)
|
|
399
|
+
: lastResultRef.current;
|
|
397
400
|
},
|
|
398
401
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
399
402
|
[thing, returnType, listenable, ...args],
|
package/ui-react-dom/index.js
CHANGED
|
@@ -214,16 +214,19 @@ const addAndDelListener = (thing, listenable, ...args) => {
|
|
|
214
214
|
return () => thing?.delListener?.(listenerId);
|
|
215
215
|
};
|
|
216
216
|
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
217
|
-
const
|
|
217
|
+
const lastResultRef = useRef(DEFAULTS[returnType]);
|
|
218
218
|
const getResult = useCallback(
|
|
219
219
|
() => {
|
|
220
220
|
const nextResult =
|
|
221
221
|
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
222
222
|
...args,
|
|
223
223
|
) ?? DEFAULTS[returnType];
|
|
224
|
-
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
225
|
+
nextResult,
|
|
226
|
+
lastResultRef.current,
|
|
227
|
+
)
|
|
228
|
+
? (lastResultRef.current = nextResult)
|
|
229
|
+
: lastResultRef.current;
|
|
227
230
|
},
|
|
228
231
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
229
232
|
[thing, returnType, listenable, ...args],
|
|
@@ -214,16 +214,19 @@ const addAndDelListener = (thing, listenable, ...args) => {
|
|
|
214
214
|
return () => thing?.delListener?.(listenerId);
|
|
215
215
|
};
|
|
216
216
|
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
217
|
-
const
|
|
217
|
+
const lastResultRef = useRef(DEFAULTS[returnType]);
|
|
218
218
|
const getResult = useCallback(
|
|
219
219
|
() => {
|
|
220
220
|
const nextResult =
|
|
221
221
|
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
222
222
|
...args,
|
|
223
223
|
) ?? DEFAULTS[returnType];
|
|
224
|
-
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
225
|
+
nextResult,
|
|
226
|
+
lastResultRef.current,
|
|
227
|
+
)
|
|
228
|
+
? (lastResultRef.current = nextResult)
|
|
229
|
+
: lastResultRef.current;
|
|
227
230
|
},
|
|
228
231
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
229
232
|
[thing, returnType, listenable, ...args],
|
|
@@ -3006,16 +3006,19 @@ const addAndDelListener = (thing, listenable, ...args) => {
|
|
|
3006
3006
|
return () => thing?.delListener?.(listenerId);
|
|
3007
3007
|
};
|
|
3008
3008
|
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
3009
|
-
const
|
|
3009
|
+
const lastResultRef = useRef(DEFAULTS[returnType]);
|
|
3010
3010
|
const getResult = useCallback(
|
|
3011
3011
|
() => {
|
|
3012
3012
|
const nextResult =
|
|
3013
3013
|
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
3014
3014
|
...args,
|
|
3015
3015
|
) ?? DEFAULTS[returnType];
|
|
3016
|
-
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
3017
|
-
|
|
3018
|
-
|
|
3016
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
3017
|
+
nextResult,
|
|
3018
|
+
lastResultRef.current,
|
|
3019
|
+
)
|
|
3020
|
+
? (lastResultRef.current = nextResult)
|
|
3021
|
+
: lastResultRef.current;
|
|
3019
3022
|
},
|
|
3020
3023
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
3021
3024
|
[thing, returnType, listenable, ...args],
|
|
@@ -3006,16 +3006,19 @@ const addAndDelListener = (thing, listenable, ...args) => {
|
|
|
3006
3006
|
return () => thing?.delListener?.(listenerId);
|
|
3007
3007
|
};
|
|
3008
3008
|
const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
3009
|
-
const
|
|
3009
|
+
const lastResultRef = useRef(DEFAULTS[returnType]);
|
|
3010
3010
|
const getResult = useCallback(
|
|
3011
3011
|
() => {
|
|
3012
3012
|
const nextResult =
|
|
3013
3013
|
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
3014
3014
|
...args,
|
|
3015
3015
|
) ?? DEFAULTS[returnType];
|
|
3016
|
-
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
3017
|
-
|
|
3018
|
-
|
|
3016
|
+
return !(IS_EQUALS[returnType] ?? isEqual)(
|
|
3017
|
+
nextResult,
|
|
3018
|
+
lastResultRef.current,
|
|
3019
|
+
)
|
|
3020
|
+
? (lastResultRef.current = nextResult)
|
|
3021
|
+
: lastResultRef.current;
|
|
3019
3022
|
},
|
|
3020
3023
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
3021
3024
|
[thing, returnType, listenable, ...args],
|