1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix: Uncaught Error: ModelService: Cannot add model because it already exists!

(how-to-reproduce: open/close dock with tabs)

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2021-09-30 15:06:18 +03:00
parent 0adc66d412
commit 13786930eb

View File

@ -103,6 +103,12 @@ export class MonacoEditor extends React.Component<Props> {
}
};
componentWillUnmount() {
logger.info(`[MONACO]: unmounting editor..`);
MonacoEditor.models.get(this).forEach(model => model.dispose());
MonacoEditor.models.delete(this);
}
createUri(id: string): monaco.Uri {
return monaco.Uri.file(`/monaco-editor/${id}`);
}