Fix machines display on overview; disable inline PDF thumbnails

This commit is contained in:
Matthieu
2026-01-25 09:46:11 +01:00
parent 1f5f1509a9
commit 55739fe50f
2 changed files with 57 additions and 23 deletions

View File

@@ -12,12 +12,6 @@
loading="lazy"
decoding="async"
>
<iframe
v-else-if="canRenderPdf"
:src="previewSrc"
class="h-full w-full border-0 bg-white"
title="Aperçu PDF"
/>
<component
v-else
:is="icon.component"
@@ -54,8 +48,6 @@ const props = defineProps<{
alt?: string;
}>();
const PDF_PREVIEW_MAX_BYTES = 5 * 1024 * 1024;
const normalizedDocument = computed(() => props.document ?? null);
const canRenderImage = computed(() => {
@@ -64,14 +56,9 @@ const canRenderImage = computed(() => {
});
const canRenderPdf = computed(() => {
const doc = normalizedDocument.value;
if (!doc || !isPdfDocument(doc) || !doc.path) {
return false;
}
if (typeof doc.size === 'number' && doc.size > PDF_PREVIEW_MAX_BYTES) {
return false;
}
return true;
// Rendering many PDF iframes in a list is very heavy for the browser.
// We intentionally disable inline PDF previews and fall back to an icon.
return false;
});
const appendPdfViewerParams = (src: string) => {