From 5181be10113258320a59d7c2ca0c478d6c26a7a6 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Tue, 16 Jul 2024 19:27:14 +0200 Subject: [PATCH] website: monaco loading improvements --- website/src/monaco-loader.ts | 4 ++++ website/src/website/components/monaco/MonacoEditor.tsx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/website/src/monaco-loader.ts b/website/src/monaco-loader.ts index 898b08d7..1c3184fc 100644 --- a/website/src/monaco-loader.ts +++ b/website/src/monaco-loader.ts @@ -62,6 +62,10 @@ async function _loadMonaco(setup: IMonacoSetup): Promise { return new Promise((res) => { // First load editor.main. If it inlines the plugins, we don't want to try to load them from the server. req(["vs/editor/editor.main"], () => { + if ((setup as any).onlyCore) { + res(monaco); + return; + } req( [ "vs/basic-languages/monaco.contribution", diff --git a/website/src/website/components/monaco/MonacoEditor.tsx b/website/src/website/components/monaco/MonacoEditor.tsx index 57e47761..9546ce93 100644 --- a/website/src/website/components/monaco/MonacoEditor.tsx +++ b/website/src/website/components/monaco/MonacoEditor.tsx @@ -17,6 +17,10 @@ export class ControlledMonacoEditor extends React.Component<{ private lastSubscription: monaco.IDisposable | undefined; + componentDidMount(): void { + this.componentDidUpdate({ value: "" }); + } + componentDidUpdate(lastProps: this["props"]) { const newOnDidValueChange = this.props.onDidValueChange; if (newOnDidValueChange !== lastProps.onDidValueChange) {