Fix build

This commit is contained in:
Gregory Schier
2023-03-29 22:15:55 -07:00
parent 968e80b3ad
commit fa32829b2e
9 changed files with 54 additions and 37 deletions

View File

@@ -92,11 +92,8 @@ export function Editor({
useEffect(() => {
if (cm.current === null) return;
const { view, languageCompartment } = cm.current;
const newDoc = defaultValue;
view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: newDoc ?? '' } });
const ext = getLanguageExtension({ contentType, useTemplating, autocomplete });
view.dispatch({ effects: languageCompartment.reconfigure(ext) });
const { view } = cm.current;
view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: defaultValue ?? '' } });
}, [forceUpdateKey]);
// Initialize the editor when ref mounts

View File

@@ -1,7 +1,10 @@
import { memo } from 'react';
import * as editor from './Editor';
export type { EditorProps } from './Editor';
const editor = await import('./Editor');
// TODO: Figure out why code-splitting breaks production build from
// showing any content
// const editor = await import('./Editor');
export const Editor = memo(editor.Editor);
export const graphql = editor.graphql;