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

fix: terminal resize on initial open (dock without tabs)

fix: console errors when closing all dock tabs

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2021-10-20 13:38:56 +03:00
parent 969be592de
commit 22a800ce73
4 changed files with 11 additions and 13 deletions

View File

@ -32,7 +32,7 @@ import throttle from "lodash/throttle";
export interface DockTabContentProps extends React.HTMLAttributes<any> {
className?: string;
tab: DockTab;
tab?: DockTab;
bindContainerRef?(elem: HTMLElement): void;
}
@ -55,18 +55,18 @@ export class DockTabContent extends React.Component<DockTabContentProps> {
]);
}
@computed get tabId(): TabId {
return this.props.tab.id;
@computed get tabId(): TabId | undefined {
return this.props.tab?.id;
}
@computed get tabComponents(): DockTabComponents {
return dockViewsManager.get(this.props.tab.kind);
@computed get tabComponents(): DockTabComponents | undefined {
return dockViewsManager.get(this.props.tab?.kind);
}
@observable error = "";
@computed get editorIsVisible() {
return Boolean(this.tabComponents.editor);
return Boolean(this.tabComponents?.editor);
}
focusEditor() {

View File

@ -40,7 +40,7 @@ const dockViews = observable.map<TabKind, DockTabComponents>([], {
export const dockViewsManager = {
get(tabKind: TabKind): DockTabComponents {
return dockViews.get(tabKind) ?? {};
return dockViews.get(tabKind);
},
register(tabKind: TabKind, views: DockTabComponents) {

View File

@ -47,7 +47,9 @@ export class TerminalWindow extends React.Component<Props> {
}),
// refresh terminal available space (cols/rows) when <Dock/> resized
dockStore.onResize(() => this.terminal?.fitLazy()),
dockStore.onResize(() => this.terminal?.fitLazy(), {
fireImmediately: true,
}),
]);
}

View File

@ -179,11 +179,7 @@ export class MonacoEditor extends React.Component<MonacoEditorProps> {
reaction(() => this.model, this.onModelChange),
reaction(() => this.props.theme, editor.setTheme),
reaction(() => this.props.value, value => this.setValue(value)),
reaction(() => this.options, opts => {
console.log('OPTS', opts)
this.editor.updateOptions(opts);
}),
reaction(() => this.options, opts => this.editor.updateOptions(opts)),
() => onDidLayoutChangeDisposer.dispose(),
() => onValueChangeDisposer.dispose(),