perf: reuse preview on apply instead of reprocessing
Pass the already-processed preview data URL when applying edits. The thumbnail updates instantly without triggering another process cycle. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
image: ImageEntry | null;
|
||||
device: Device;
|
||||
onClose: () => void;
|
||||
onApply: (imageId: string, config: PipelineConfig) => void;
|
||||
onApply: (imageId: string, config: PipelineConfig, processedDataUrl: string | null) => void;
|
||||
}
|
||||
|
||||
let { open, image, device, onClose, onApply }: Props = $props();
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
function handleApply(): void {
|
||||
if (!image) return;
|
||||
onApply(image.id, localConfig);
|
||||
onApply(image.id, localConfig, previewDataUrl);
|
||||
onClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,9 +89,15 @@
|
||||
editingImage = null;
|
||||
}
|
||||
|
||||
function handleApplyPipeline(imageId: string, config: PipelineConfig): void {
|
||||
function handleApplyPipeline(imageId: string, config: PipelineConfig, processedDataUrl: string | null): void {
|
||||
imagesStore.setPipelineOverride(imageId, config);
|
||||
imagesStore.reprocessImage(imageId, deviceStore.selected);
|
||||
if (processedDataUrl) {
|
||||
// Use the already-processed preview directly
|
||||
imagesStore.updateImage(imageId, { processedDataUrl });
|
||||
} else {
|
||||
// Fallback: reprocess if no preview available
|
||||
imagesStore.reprocessImage(imageId, deviceStore.selected);
|
||||
}
|
||||
}
|
||||
|
||||
function handleClearAll(): void {
|
||||
|
||||
Reference in New Issue
Block a user