@faasjs/react 6.11.1 → 6.12.1

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/index.cjs CHANGED
@@ -258,30 +258,32 @@ function useFaas(action, defaultParams, options = {}) {
258
258
  setFails(1);
259
259
  return send();
260
260
  }
261
+ let error2 = e;
261
262
  if (client.onError)
262
263
  try {
263
264
  await client.onError(action, params)(e);
264
- } catch (error2) {
265
- setError(error2);
265
+ } catch (newError) {
266
+ error2 = newError;
266
267
  }
267
- else setError(e);
268
+ setError(error2);
268
269
  setLoading(false);
269
- for (const { reject } of pendingReloadsRef.current.values()) reject(e);
270
+ for (const { reject } of pendingReloadsRef.current.values())
271
+ reject(error2);
270
272
  pendingReloadsRef.current.clear();
271
- return Promise.reject(e);
273
+ return;
272
274
  });
273
275
  }
274
276
  if (options.debounce) {
275
277
  const timeout = setTimeout(send, options.debounce);
276
278
  return () => {
277
279
  clearTimeout(timeout);
278
- controllerRef.current?.abort();
280
+ controllerRef.current?.abort("debounce");
279
281
  setLoading(false);
280
282
  };
281
283
  }
282
284
  send();
283
285
  return () => {
284
- controllerRef.current?.abort();
286
+ controllerRef.current?.abort("unmount");
285
287
  setLoading(false);
286
288
  };
287
289
  }, [action, options.params || params, reloadTimes, skip]);
package/dist/index.mjs CHANGED
@@ -256,30 +256,32 @@ function useFaas(action, defaultParams, options = {}) {
256
256
  setFails(1);
257
257
  return send();
258
258
  }
259
+ let error2 = e;
259
260
  if (client.onError)
260
261
  try {
261
262
  await client.onError(action, params)(e);
262
- } catch (error2) {
263
- setError(error2);
263
+ } catch (newError) {
264
+ error2 = newError;
264
265
  }
265
- else setError(e);
266
+ setError(error2);
266
267
  setLoading(false);
267
- for (const { reject } of pendingReloadsRef.current.values()) reject(e);
268
+ for (const { reject } of pendingReloadsRef.current.values())
269
+ reject(error2);
268
270
  pendingReloadsRef.current.clear();
269
- return Promise.reject(e);
271
+ return;
270
272
  });
271
273
  }
272
274
  if (options.debounce) {
273
275
  const timeout = setTimeout(send, options.debounce);
274
276
  return () => {
275
277
  clearTimeout(timeout);
276
- controllerRef.current?.abort();
278
+ controllerRef.current?.abort("debounce");
277
279
  setLoading(false);
278
280
  };
279
281
  }
280
282
  send();
281
283
  return () => {
282
- controllerRef.current?.abort();
284
+ controllerRef.current?.abort("unmount");
283
285
  setLoading(false);
284
286
  };
285
287
  }, [action, options.params || params, reloadTimes, skip]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/react",
3
- "version": "6.11.1",
3
+ "version": "6.12.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -30,10 +30,10 @@
30
30
  "dist"
31
31
  ],
32
32
  "peerDependencies": {
33
- "@faasjs/browser": ">=6.11.1"
33
+ "@faasjs/browser": ">=6.12.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@faasjs/browser": ">=6.11.1",
36
+ "@faasjs/browser": ">=6.12.1",
37
37
  "@types/react": "*",
38
38
  "react": "*"
39
39
  },