mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Removed package "autobind-decorator" and @boundMethod in favour of "auto-bind" util for constructors-only. (#5218)
This commit is contained in:
1 parent
5f145e69e5
commit
06e7dfce5e
45 files changed
+150
-180
No files matched your search
@@ -7,7 +7,7 @@ import styles from "./dock-tab.module.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { boundMethod, cssNames, prevDefault, isMiddleClick } from "../../utils";
|
||||
import { autoBind, cssNames, prevDefault, isMiddleClick } from "../../utils";
|
||||
import type { DockStore, DockTab as DockTabModel } from "./dock/store";
|
||||
import type { TabProps } from "../tabs";
|
||||
import { Tab } from "../tabs";
|
||||
@@ -34,13 +34,13 @@ class NonInjectedDockTab extends React.Component<DockTabProps & Dependencies> {
|
||||
constructor(props: DockTabProps & Dependencies) {
|
||||
super(props);
|
||||
makeObservable(this);
|
||||
autoBind(this);
|
||||
}
|
||||
|
||||
get tabId() {
|
||||
return this.props.value.id;
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
close() {
|
||||
this.props.dockStore.closeTab(this.tabId);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import moment from "moment-timezone";
|
||||
import type { Align, ListOnScrollProps } from "react-window";
|
||||
import { SearchStore } from "../../../search-store/search-store";
|
||||
import { UserStore } from "../../../../common/user-store";
|
||||
import { array, boundMethod, cssNames } from "../../../utils";
|
||||
import { array, autoBind, cssNames } from "../../../utils";
|
||||
import { VirtualList } from "../../virtual-list";
|
||||
import { ToBottom } from "./to-bottom";
|
||||
import type { LogTabViewModel } from "../logs/logs-view-model";
|
||||
@@ -39,6 +39,7 @@ export class LogList extends React.Component<LogListProps> {
|
||||
constructor(props: LogListProps) {
|
||||
super(props);
|
||||
makeObservable(this);
|
||||
autoBind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -51,14 +52,12 @@ export class LogList extends React.Component<LogListProps> {
|
||||
]);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
onLogsInitialLoad(logs: string[], prevLogs: string[]) {
|
||||
if (!prevLogs.length && logs.length) {
|
||||
this.isLastLineVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
onLogsUpdate() {
|
||||
if (this.isLastLineVisible) {
|
||||
setTimeout(() => {
|
||||
@@ -67,7 +66,6 @@ export class LogList extends React.Component<LogListProps> {
|
||||
}
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
onUserScrolledUp(logs: string[], prevLogs: string[]) {
|
||||
if (!this.virtualListDiv.current) return;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
import "./terminal-dock-tab.scss";
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { boundMethod, cssNames } from "../../../utils";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { autoBind, cssNames } from "../../../utils";
|
||||
import type { DockTabProps } from "../dock-tab";
|
||||
import { DockTab } from "../dock-tab";
|
||||
import { Icon } from "../../icon";
|
||||
@@ -26,11 +26,18 @@ interface Dependencies {
|
||||
}
|
||||
|
||||
@observer
|
||||
class NonInjectedTerminalTab extends React.Component<TerminalTabProps & Dependencies> {
|
||||
class NonInjectedTerminalTab<Props extends TerminalTabProps & Dependencies> extends React.Component<Props> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
autoBind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
reaction(() => this.isDisconnected === true, () => {
|
||||
this.props.dockStore.closeTab(this.tabId);
|
||||
});
|
||||
disposeOnUnmount(this, [
|
||||
reaction(() => this.isDisconnected === true, () => {
|
||||
this.props.dockStore.closeTab(this.tabId);
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
get tabId() {
|
||||
@@ -41,7 +48,6 @@ class NonInjectedTerminalTab extends React.Component<TerminalTabProps & Dependen
|
||||
return this.props.terminalStore.isDisconnected(this.tabId);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
reconnect() {
|
||||
this.props.terminalStore.reconnect(this.tabId);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user