Open underthesand opened 1 year ago
I'm experiencing same issue with different setup
<template>
<div class="me-container" style="height: 350px">
<MonacoEditor
style="height: 350px"
ref="editor"
:options="{
theme: 'hc-black',
automaticLayout: true,
}"
lang="sol"
v-if="sourceCode"
v-model="sourceCode"
/>
</div>
<button @click='searchText("Hello")' />
</template>
<script setup>
const editor = ref();
const sourceCode = ref("Hello world")
function searchText(text) {
editor.value.getModel().findAllMatches(text); // Freezes.
}
</script>
Possible fix, maybe it will help someone. Using <ClientOnly>
on template or using useMonaco and onMounted.
<ClientOnly>
<MonacoEditor :options="{ theme: 'vs-dark' }" />
</ClientOnly>
const monaco = useMonaco()!;
const editorEl = ref<HTMLDivElement>();
onMounted(() => {
if (editorEl.value) {
const editor = monaco.editor.create(editorEl.value, {
theme: "vs-dark",
language: "shell",
automaticLayout: true,
});
// You can configure the editor or add event listeners here.
}
});
For me the issue is already when i enable the module. Don't even need to add the component anywhere.
For me the issue is already when i enable the module. Don't even need to add the component anywhere.
Try to put the module first in the list, even though it sounds silly, it might help.
I think it has something to do with the internal mechanism of monaco-editor
.
Anyway don't do anything on ref(editor)
, use toRaw()
to receive the ref
, or use shallowRef()
.
Vue 3's circular references will cause the browser to crash.
Having the same issue. My tab is even freezing when just adding the module (not even using useMonaco
, one of the components) recently.
Hello,
I've encountered multiple instances of freezing with this module, specifically when refreshing the browser multiple times. This occurs in both clean sessions and private navigation modes.
Environment:
Here are the steps to reproduce the issue and relevant configuration files:
Installation and Initialization:
App.vue File:
package.json File:
I've tested the module with Firefox and it works fine there. Additionally, when tested with Chrome and Express, no issues were encountered.
Express Configuration:
Best regards,