fix(image-pipeline): coalesce preview churn to latest state

This commit is contained in:
Matthias
2026-04-04 12:11:39 +02:00
parent 9a6192752e
commit d02e6924f3
2 changed files with 196 additions and 8 deletions

View File

@@ -20,6 +20,8 @@ type UsePipelinePreviewOptions = {
maxDevicePixelRatio?: number;
};
const PREVIEW_RENDER_DEBOUNCE_MS = 48;
function computePreviewWidth(
nodeWidth: number,
previewScale: number,
@@ -159,7 +161,7 @@ export function usePipelinePreview(options: UsePipelinePreviewOptions): {
if (runIdRef.current !== currentRun) return;
setIsRendering(false);
});
}, 16);
}, PREVIEW_RENDER_DEBOUNCE_MS);
return () => {
window.clearTimeout(timer);