mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: QA sweep -- SSE crash, memory leaks, HEIC Docker decode, TGA detection, lint cleanup
- Fix SSE write-after-end crash in progress.ts (remove callback before ending stream) - Fix blob URL memory leaks: revoke processedPreviewUrl and old HEIC preview URLs - Add AbortController to batch fetch in use-tool-processor and use-pipeline-processor - Fix TGA format misidentified as CUR (extension overrides magic bytes) - Add libheif-plugin-libde265 to Docker for HEIC/HEIF decode support - Remove unused imports and state (AppLayout, setSampledColor, useEffect) - Fix non-null assertions in meme-text-renderer and meme-generator - Fix confusing void type in meme-templates - Remove unnecessary useEffect deps in adjustments-panel - Fix Playwright strict mode violations in 5 E2E tests
This commit is contained in:
@@ -39,6 +39,7 @@ function revokeEntries(entries: FileEntry[]): void {
|
||||
for (const entry of entries) {
|
||||
URL.revokeObjectURL(entry.blobUrl);
|
||||
if (entry.processedUrl) URL.revokeObjectURL(entry.processedUrl);
|
||||
if (entry.processedPreviewUrl) URL.revokeObjectURL(entry.processedPreviewUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +151,9 @@ export const useFileStore = create<FileState>((set, get) => ({
|
||||
const state = get();
|
||||
if (state.entries[i]?.file !== file) return;
|
||||
const updated = [...state.entries];
|
||||
const oldBlobUrl = updated[i].blobUrl;
|
||||
updated[i] = { ...updated[i], previewLoading: false, ...(url ? { blobUrl: url } : {}) };
|
||||
if (url && oldBlobUrl) URL.revokeObjectURL(oldBlobUrl);
|
||||
set({ entries: updated, ...deriveSelected(updated, state.selectedIndex) });
|
||||
});
|
||||
}
|
||||
@@ -172,7 +175,9 @@ export const useFileStore = create<FileState>((set, get) => ({
|
||||
const state = get();
|
||||
if (state.entries[i]?.file !== file) return;
|
||||
const updated = [...state.entries];
|
||||
const oldBlobUrl = updated[i].blobUrl;
|
||||
updated[i] = { ...updated[i], previewLoading: false, ...(url ? { blobUrl: url } : {}) };
|
||||
if (url && oldBlobUrl) URL.revokeObjectURL(oldBlobUrl);
|
||||
set({ entries: updated, ...deriveSelected(updated, state.selectedIndex) });
|
||||
});
|
||||
}
|
||||
@@ -186,6 +191,7 @@ export const useFileStore = create<FileState>((set, get) => ({
|
||||
|
||||
URL.revokeObjectURL(removed.blobUrl);
|
||||
if (removed.processedUrl) URL.revokeObjectURL(removed.processedUrl);
|
||||
if (removed.processedPreviewUrl) URL.revokeObjectURL(removed.processedPreviewUrl);
|
||||
|
||||
const newEntries = entries.filter((_, i) => i !== index);
|
||||
let newIndex = selectedIndex;
|
||||
@@ -285,6 +291,7 @@ export const useFileStore = create<FileState>((set, get) => ({
|
||||
const { entries, selectedIndex } = get();
|
||||
for (const entry of entries) {
|
||||
if (entry.processedUrl) URL.revokeObjectURL(entry.processedUrl);
|
||||
if (entry.processedPreviewUrl) URL.revokeObjectURL(entry.processedPreviewUrl);
|
||||
}
|
||||
const resetEntries = entries.map((e) => ({
|
||||
...e,
|
||||
|
||||
Reference in New Issue
Block a user