@usefillo/react 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -211,6 +211,7 @@ function FileUploadField({ field, value, error, setValue, api }) {
211
211
  const [dragOver, setDragOver] = useState3(false);
212
212
  const mountedRef = useRef3(true);
213
213
  const controllers = useRef3(/* @__PURE__ */ new Map());
214
+ const inFlightCount = useRef3(0);
214
215
  useEffect4(
215
216
  () => () => {
216
217
  mountedRef.current = false;
@@ -233,6 +234,7 @@ function FileUploadField({ field, value, error, setValue, api }) {
233
234
  return;
234
235
  }
235
236
  setInFlight((prev) => [...prev, { key, name: file.name, size: file.size, fraction: 0 }]);
237
+ inFlightCount.current += 1;
236
238
  api.setUploading(field.id, true);
237
239
  const controller = new AbortController();
238
240
  controllers.current.set(key, controller);
@@ -258,7 +260,8 @@ function FileUploadField({ field, value, error, setValue, api }) {
258
260
  }
259
261
  } finally {
260
262
  controllers.current.delete(key);
261
- if (mountedRef.current) api.setUploading(field.id, false);
263
+ inFlightCount.current -= 1;
264
+ if (mountedRef.current && inFlightCount.current === 0) api.setUploading(field.id, false);
262
265
  }
263
266
  }
264
267
  function cancelUpload(key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/react",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Headless React components for embedding Fillo forms natively in your product.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "@usefillo/core": "^0.2.1"
39
+ "@usefillo/core": "^0.2.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18.0.0 || ^19.0.0",