replacing toJS({}) to utils/cloneJson where might be necessary

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman committed 2021-04-23 16:18:35 +03:00
1 parent f620c09095
commit 4fbefb648a
19 files changed
+110 -110

No files matched your search

@@ -1,6 +1,6 @@
import { Select } from "../select";
import { computed, observable, toJS, makeObservable } from "mobx";
import { computed, observable, makeObservable } from "mobx";
import { observer } from "mobx-react";
import React from "react";
import { commandRegistry } from "../../../extensions/registries/command-registry";
@@ -52,13 +52,11 @@ export class CommandDialog extends React.Component {
return;
}
const action = toJS(command.action);
try {
CommandOverlay.close();
if (command.scope === "global") {
action({
command.action({
entity: commandRegistry.activeEntity
});
} else if(commandRegistry.activeEntity) {
+7 -8
View File
@@ -1,13 +1,12 @@
import debounce from "lodash/debounce";
import { reaction, toJS } from "mobx";
import { reaction } from "mobx";
import { Terminal as XTerm } from "xterm";
import { FitAddon } from "xterm-addon-fit";
import { dockStore, TabId } from "./dock.store";
import { TerminalApi } from "../../api/terminal-api";
import { ThemeStore } from "../../theme.store";
import { autobind } from "../../utils";
import { autobind, cloneJson } from "../../utils";
import { isMac } from "../../../common/vars";
import { camelCase } from "lodash";
import { camelCase, debounce } from "lodash";
export class Terminal {
static spawningPool: HTMLElement;
@@ -104,7 +103,7 @@ export class Terminal {
window.addEventListener("resize", this.onResize);
this.disposers.push(
reaction(() => toJS(ThemeStore.getInstance().activeTheme.colors), this.setTheme, {
reaction(() => cloneJson(ThemeStore.getInstance().activeTheme.colors), this.setTheme, {
fireImmediately: true
}),
dockStore.onResize(this.onResize),
@@ -132,7 +131,7 @@ export class Terminal {
const { cols, rows } = this.xterm;
this.api.sendTerminalSize(cols, rows);
} catch(error) {
} catch (error) {
console.error(error);
return; // see https://github.com/lensapp/lens/issues/1891
@@ -183,12 +182,12 @@ export class Terminal {
// Handle custom hotkey bindings
if (ctrlKey) {
switch (code) {
// Ctrl+C: prevent terminal exit on windows / linux (?)
// Ctrl+C: prevent terminal exit on windows / linux (?)
case "KeyC":
if (this.xterm.hasSelection()) return false;
break;
// Ctrl+W: prevent unexpected terminal tab closing, e.g. editing file in vim
// Ctrl+W: prevent unexpected terminal tab closing, e.g. editing file in vim
case "KeyW":
evt.preventDefault();
break;