@cripty2001/utils 0.0.161 → 0.0.162
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/dist/react-whispr.d.ts +1 -1
- package/dist/react-whispr.js +5 -2
- package/package.json +1 -1
package/dist/react-whispr.d.ts
CHANGED
|
@@ -195,6 +195,6 @@ export type AsyncInputValue<C extends Record<string, JSONEncodable>, R extends R
|
|
|
195
195
|
*/
|
|
196
196
|
export declare function useAsyncInput<C extends Record<string, JSONEncodable>, R extends Record<string, JSONEncodable>>(value: AsyncInputValue<C, R>, setValue: (value: AsyncInputValue<C, R>) => void, handler: (config: C) => Promise<R>): [
|
|
197
197
|
value: C,
|
|
198
|
-
setValue: (
|
|
198
|
+
setValue: (updater: (draft: C) => C | void) => void,
|
|
199
199
|
result: R | null
|
|
200
200
|
];
|
package/dist/react-whispr.js
CHANGED
|
@@ -390,9 +390,12 @@ function useAsyncInput(value, setValue, handler) {
|
|
|
390
390
|
return;
|
|
391
391
|
setValue(result);
|
|
392
392
|
}, [result, setValue]);
|
|
393
|
-
const returnedSetValue = (0, react_1.useCallback)((
|
|
393
|
+
const returnedSetValue = (0, react_1.useCallback)((updater) => {
|
|
394
|
+
const cloned = structuredClone(meta.config);
|
|
395
|
+
const new_data = updater(cloned);
|
|
396
|
+
const chosen = new_data ?? cloned;
|
|
394
397
|
setMeta({
|
|
395
|
-
config:
|
|
398
|
+
config: chosen,
|
|
396
399
|
ts: Date.now(),
|
|
397
400
|
});
|
|
398
401
|
}, [setMeta]);
|
package/package.json
CHANGED