Improve lazy loading (#12393)
Creating manual chunk was a bad idea, we should always solve lazy loading problem at the source instance. Setting a 4.5MB for the index bundle size, CI will fail if we go above. There is still a lot of room for optimizations! - More agressive lazy loading (e.g. xyflow and tiptap are still loaded in index!) - Add a prefetch mechanism - Add stronger CI checks to make sure libraries we've set asides are not added back - Fix AllIcons component with does not work as intended (loaded on initial load)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import { Action } from '@/action-menu/actions/components/Action';
|
||||
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { BlockNoteEditor } from '@blocknote/core';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
@ -33,15 +32,11 @@ export const ExportNoteActionSingleRecordAction = () => {
|
||||
console.warn(initialBody);
|
||||
}
|
||||
|
||||
const editor = BlockNoteEditor.create({
|
||||
initialContent: parsedBody,
|
||||
});
|
||||
|
||||
const { exportBlockNoteEditorToPdf } = await import(
|
||||
'@/action-menu/actions/record-actions/single-record/utils/exportBlockNoteEditorToPdf'
|
||||
);
|
||||
|
||||
await exportBlockNoteEditorToPdf(editor, filename);
|
||||
await exportBlockNoteEditorToPdf(parsedBody, filename);
|
||||
|
||||
// TODO later: implement DOCX export
|
||||
// const { exportBlockNoteEditorToDocx } = await import(
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { BlockNoteEditor } from '@blocknote/core';
|
||||
import { BlockNoteEditor, PartialBlock } from '@blocknote/core';
|
||||
import {
|
||||
PDFExporter,
|
||||
pdfDefaultSchemaMappings,
|
||||
@ -7,9 +7,13 @@ import { pdf } from '@react-pdf/renderer';
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
export const exportBlockNoteEditorToPdf = async (
|
||||
editor: BlockNoteEditor,
|
||||
parsedBody: PartialBlock[],
|
||||
filename: string,
|
||||
) => {
|
||||
const editor = BlockNoteEditor.create({
|
||||
initialContent: parsedBody,
|
||||
});
|
||||
|
||||
const exporter = new PDFExporter(editor.schema, pdfDefaultSchemaMappings);
|
||||
|
||||
const pdfDocument = await exporter.toReactPDFDocument(editor.document);
|
||||
|
||||
Reference in New Issue
Block a user