@cripty2001/utils 0.0.139 → 0.0.140
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.js +5 -1
- package/package.json +1 -1
package/dist/react-whispr.js
CHANGED
|
@@ -148,7 +148,11 @@ function useSynced(def, value, setValue) {
|
|
|
148
148
|
*/
|
|
149
149
|
function useAsync(f, data, debouce = 200) {
|
|
150
150
|
// Initing reactive input
|
|
151
|
-
const
|
|
151
|
+
const whisprRef = (0, react_1.useRef)(null);
|
|
152
|
+
if (!whisprRef.current) {
|
|
153
|
+
whisprRef.current = whispr_1.Whispr.create(data ?? (0, _1.getRandomId)());
|
|
154
|
+
}
|
|
155
|
+
const [input, setInput] = whisprRef.current;
|
|
152
156
|
if (data !== null) {
|
|
153
157
|
(0, react_1.useEffect)(() => {
|
|
154
158
|
setInput(data); // Debouncing already handled by dispatcher
|
package/package.json
CHANGED