@ai-matrx/media 0.5.1 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-matrx/media
2
2
 
3
+ ## 0.5.2 — 2026-09-09
4
+
5
+ ### Consumer action (C28)
6
+
7
+ - Upgrade. No API change; late object-URL recovery results cannot affect a
8
+ replacement file or an unmounted renderer.
9
+
10
+ ### Fixed
11
+
12
+ - Blob recovery verdicts and rejections are scoped to the mounted file
13
+ generation. Selecting another file invalidates the old completion without
14
+ changing the client-owned retry allowance or current-file diagnostics.
15
+
3
16
  ## 0.5.1 — 2026-09-08
4
17
 
5
18
  ### Consumer action (C28)
package/dist/react.cjs CHANGED
@@ -688,13 +688,18 @@ function useMediaBlobLoadRecovery(ref, source, options) {
688
688
  const refKey = stableRefKey(ref);
689
689
  const [failed, setFailed] = (0, import_react4.useState)(false);
690
690
  const attemptRef = (0, import_react4.useRef)(0);
691
+ const generationRef = (0, import_react4.useRef)(0);
691
692
  const recoveryInFlightRef = (0, import_react4.useRef)(false);
692
693
  const onRetry = options.onRetry;
693
694
  const onTerminal = options.onTerminal;
694
695
  (0, import_react4.useEffect)(() => {
696
+ generationRef.current += 1;
695
697
  attemptRef.current = 0;
696
698
  recoveryInFlightRef.current = false;
697
699
  setFailed(false);
700
+ return () => {
701
+ generationRef.current += 1;
702
+ };
698
703
  }, [refKey]);
699
704
  (0, import_react4.useEffect)(() => {
700
705
  recoveryInFlightRef.current = false;
@@ -719,6 +724,7 @@ function useMediaBlobLoadRecovery(ref, source, options) {
719
724
  recoveryInFlightRef.current = true;
720
725
  attemptRef.current += 1;
721
726
  const attempt = attemptRef.current;
727
+ const generation = generationRef.current;
722
728
  const recover = client.recoverBlobLoadError;
723
729
  if (!ref || !recover) {
724
730
  finishTerminal(
@@ -730,6 +736,7 @@ function useMediaBlobLoadRecovery(ref, source, options) {
730
736
  }
731
737
  recover(ref, attempt).then(
732
738
  (verdict) => {
739
+ if (generation !== generationRef.current) return;
733
740
  if (verdict === "retry") {
734
741
  setFailed(false);
735
742
  onRetry();
@@ -742,6 +749,7 @@ function useMediaBlobLoadRecovery(ref, source, options) {
742
749
  );
743
750
  },
744
751
  (err) => {
752
+ if (generation !== generationRef.current) return;
745
753
  finishTerminal(
746
754
  event,
747
755
  attempt,