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:
parent
0adc66d412
commit
13786930eb
@ -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 {
|
createUri(id: string): monaco.Uri {
|
||||||
return monaco.Uri.file(`/monaco-editor/${id}`);
|
return monaco.Uri.file(`/monaco-editor/${id}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user