refactor(frontend): utility dedup, component splits, dead code removal (#193–#200) #241

Merged
marcel merged 19 commits from refactor/issues-193-200 into main 2026-04-15 15:23:16 +02:00
2 changed files with 12 additions and 2 deletions
Showing only changes of commit dbf7f0bc16 - Show all commits

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import { onMount } from 'svelte';
import { onMount, onDestroy } from 'svelte';
import { m } from '$lib/paraglide/messages.js';
import DocumentTopBar from '$lib/components/DocumentTopBar.svelte';
import DocumentViewer from '$lib/components/DocumentViewer.svelte';
@@ -31,6 +31,7 @@ $effect(() => {
async function loadFile(id: string) {
isLoading = true;
fileError = '';
if (fileUrl) URL.revokeObjectURL(fileUrl);
fileUrl = '';
try {
@@ -51,6 +52,10 @@ async function loadFile(id: string) {
}
}
onDestroy(() => {
if (fileUrl) URL.revokeObjectURL(fileUrl);
});
// ── Mode state ───────────────────────────────────────────────────────────────
let transcribeMode = $state(false);

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { enhance } from '$app/forms';
import { onMount, untrack } from 'svelte';
import { onMount, onDestroy, untrack } from 'svelte';
import { m } from '$lib/paraglide/messages.js';
import DocumentViewer from '$lib/components/DocumentViewer.svelte';
import WhoWhenSection from '$lib/components/document/WhoWhenSection.svelte';
@@ -34,6 +34,7 @@ $effect(() => {
async function loadFile(id: string) {
isLoading = true;
fileError = '';
if (fileUrl) URL.revokeObjectURL(fileUrl);
fileUrl = '';
try {
const response = await fetch(`/api/documents/${id}/file`);
@@ -47,6 +48,10 @@ async function loadFile(id: string) {
}
}
onDestroy(() => {
if (fileUrl) URL.revokeObjectURL(fileUrl);
});
// Form state
let tags = $state(untrack(() => doc.tags?.map((t: { name: string }) => t.name) ?? []));
let senderId = $state(untrack(() => doc.sender?.id ?? ''));