@waveform-playlist/ui-components 5.3.0 → 5.3.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/dist/index.mjs CHANGED
@@ -1942,6 +1942,7 @@ var SpectrogramChannel = ({
1942
1942
  }) => {
1943
1943
  const canvasesRef = useRef4([]);
1944
1944
  const registeredIdsRef = useRef4([]);
1945
+ const transferredCanvasesRef = useRef4(/* @__PURE__ */ new WeakSet());
1945
1946
  const isWorkerMode = !!(workerApi && clipId);
1946
1947
  const canvasRef = useCallback3(
1947
1948
  (canvas) => {
@@ -1962,10 +1963,12 @@ var SpectrogramChannel = ({
1962
1963
  for (let i = 0; i < canvases2.length; i++) {
1963
1964
  const canvas = canvases2[i];
1964
1965
  if (!canvas) continue;
1966
+ if (transferredCanvasesRef.current.has(canvas)) continue;
1965
1967
  const canvasId = `${clipId}-ch${index}-chunk${i}`;
1966
1968
  try {
1967
1969
  const offscreen = canvas.transferControlToOffscreen();
1968
1970
  workerApi.registerCanvas(canvasId, offscreen);
1971
+ transferredCanvasesRef.current.add(canvas);
1969
1972
  ids.push(canvasId);
1970
1973
  widths.push(Math.min(length - i * MAX_CANVAS_WIDTH2, MAX_CANVAS_WIDTH2));
1971
1974
  } catch (err) {