Commit 20b5f062 authored by tom's avatar tom

don't load model if it has already been loaded

parent 85e973c3
......@@ -43,7 +43,10 @@ const CodeEditor = ({ data }: Props) => {
monaco.editor.defineTheme('blockscout-dark', themes.dark);
monaco.editor.setTheme(colorMode === 'light' ? 'blockscout-light' : 'blockscout-dark');
data.slice(1).forEach((file) => {
const loadedModelsPaths = monaco.editor.getModels().map((model) => model.uri.path);
data.slice(1)
.filter((file) => !loadedModelsPaths.includes(file.file_path))
.forEach((file) => {
monaco.editor.createModel(file.source_code, 'sol', monaco.Uri.parse(file.file_path));
});
// componentDidMount
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment