Improve lazy loading (#12186)

WIP, using preview app to test performance (which was very bad)
This commit is contained in:
Félix Malfait
2025-05-22 15:07:01 +02:00
committed by GitHub
parent 4ac47c2a1b
commit 79b4b3f783
26 changed files with 697 additions and 104 deletions

View File

@ -1,3 +1,4 @@
import { PREVIEWABLE_EXTENSIONS } from '@/activities/files/const/previewable-extensions.const';
import { fetchCsvPreview } from '@/activities/files/utils/fetchCsvPreview';
import DocViewer, { DocViewerRenderers } from '@cyntler/react-doc-viewer';
import '@cyntler/react-doc-viewer/dist/index.css';
@ -41,29 +42,6 @@ type DocumentViewerProps = {
documentUrl: string;
};
export const PREVIEWABLE_EXTENSIONS = [
'bmp',
'csv',
'odt',
'doc',
'docx',
'gif',
'htm',
'html',
'jpg',
'jpeg',
'pdf',
'png',
'ppt',
'pptx',
'tiff',
'txt',
'xls',
'xlsx',
'mp4',
'webp',
];
const MIME_TYPE_MAPPING: Record<
(typeof PREVIEWABLE_EXTENSIONS)[number],
string