@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.
@@ -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: (value: C) => void,
198
+ setValue: (updater: (draft: C) => C | void) => void,
199
199
  result: R | null
200
200
  ];
@@ -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)((v) => {
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: v,
398
+ config: chosen,
396
399
  ts: Date.now(),
397
400
  });
398
401
  }, [setMeta]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.161",
3
+ "version": "0.0.162",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {