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;
|
image: ImageEntry | null;
|
||||||
device: Device;
|
device: Device;
|
||||||
onClose: () => void;
|
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();
|
let { open, image, device, onClose, onApply }: Props = $props();
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
function handleApply(): void {
|
function handleApply(): void {
|
||||||
if (!image) return;
|
if (!image) return;
|
||||||
onApply(image.id, localConfig);
|
onApply(image.id, localConfig, previewDataUrl);
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,10 +89,16 @@
|
|||||||
editingImage = null;
|
editingImage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleApplyPipeline(imageId: string, config: PipelineConfig): void {
|
function handleApplyPipeline(imageId: string, config: PipelineConfig, processedDataUrl: string | null): void {
|
||||||
imagesStore.setPipelineOverride(imageId, config);
|
imagesStore.setPipelineOverride(imageId, config);
|
||||||
|
if (processedDataUrl) {
|
||||||
|
// Use the already-processed preview directly
|
||||||
|
imagesStore.updateImage(imageId, { processedDataUrl });
|
||||||
|
} else {
|
||||||
|
// Fallback: reprocess if no preview available
|
||||||
imagesStore.reprocessImage(imageId, deviceStore.selected);
|
imagesStore.reprocessImage(imageId, deviceStore.selected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleClearAll(): void {
|
function handleClearAll(): void {
|
||||||
imagesStore.clearAll();
|
imagesStore.clearAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user