@cripty2001/utils 0.0.141 → 0.0.142

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.
@@ -149,18 +149,14 @@ function useSynced(def, value, setValue) {
149
149
  */
150
150
  function useAsync(f, data, debouce = 200) {
151
151
  // Initing reactive input
152
- const whisprRef = (0, react_1.useRef)(null);
153
- if (!whisprRef.current) {
154
- whisprRef.current = whispr_1.Whispr.create(data ?? (0, _1.getRandomId)());
155
- }
156
- const [input, setInput] = whisprRef.current;
152
+ const [input, setInput] = useSafeRef(() => whispr_1.Whispr.create(data ?? (0, _1.getRandomId)()));
157
153
  if (data !== null) {
158
154
  (0, react_1.useEffect)(() => {
159
155
  setInput(data); // Debouncing already handled by dispatcher
160
156
  }, [data, setInput]);
161
157
  }
162
158
  // Initing dispatcher
163
- const dispatcher = (0, react_1.useRef)(new Dispatcher_1.Dispatcher(input, f, debouce)).current;
159
+ const dispatcher = useSafeRef(() => new Dispatcher_1.Dispatcher(input, f, debouce));
164
160
  // Returning dispatcher
165
161
  return dispatcher;
166
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.141",
3
+ "version": "0.0.142",
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": {