diff --git a/src/common/utils/autobind.ts b/src/common/utils/autobind.ts index 3c7d1a7871..e8160d5aac 100644 --- a/src/common/utils/autobind.ts +++ b/src/common/utils/autobind.ts @@ -2,9 +2,7 @@ // API: https://github.com/andreypopp/autobind-decorator import bindMethodOrClass from "autobind-decorator" -// TODO: unwrap, replace usages of @autobind() to @autobind +// TODO: unwrap, replace calls @autobind() to @autobind export function autobind() { - return function (target: { new(...args: any[]): T } | object, prop?: string, descriptor?: PropertyDescriptor) { - return bindMethodOrClass(target, prop, descriptor) as any; - }; + return bindMethodOrClass; } diff --git a/src/extensions/registries/command-registry.ts b/src/extensions/registries/command-registry.ts index 865b33a491..edceef1606 100644 --- a/src/extensions/registries/command-registry.ts +++ b/src/extensions/registries/command-registry.ts @@ -1,7 +1,7 @@ // Extensions API -> Commands import { BaseRegistry } from "./base-registry"; -import { action, observable, makeObservable } from "mobx"; +import { makeObservable, observable } from "mobx"; import { LensExtension } from "../lens-extension"; import { CatalogEntity } from "../../common/catalog"; @@ -26,7 +26,6 @@ export class CommandRegistry extends BaseRegistry { makeObservable(this); } - @action add(items: CommandRegistration | CommandRegistration[], extension?: LensExtension) { const itemArray = [items].flat(); diff --git a/src/extensions/registries/page-menu-registry.ts b/src/extensions/registries/page-menu-registry.ts index e54bc7067e..ad67f4b0ce 100644 --- a/src/extensions/registries/page-menu-registry.ts +++ b/src/extensions/registries/page-menu-registry.ts @@ -2,7 +2,6 @@ import type { IconProps } from "../../renderer/components/icon"; import type React from "react"; import type { PageTarget, RegisteredPage } from "./page-registry"; -import { action, makeObservable } from "mobx"; import { BaseRegistry } from "./base-registry"; import { LensExtension } from "../lens-extension"; @@ -22,13 +21,6 @@ export interface PageMenuComponents { } export class PageMenuRegistry extends BaseRegistry { - constructor() { - super(); - - makeObservable(this); - } - - @action add(items: T[], ext: LensExtension) { const normalizedItems = items.map(menuItem => { menuItem.target = { diff --git a/src/renderer/components/cluster-settings/components/remove-cluster-button.tsx b/src/renderer/components/cluster-settings/components/remove-cluster-button.tsx index 32f7bedc64..b41aa4d9aa 100644 --- a/src/renderer/components/cluster-settings/components/remove-cluster-button.tsx +++ b/src/renderer/components/cluster-settings/components/remove-cluster-button.tsx @@ -12,11 +12,6 @@ interface Props { @observer export class RemoveClusterButton extends React.Component { - constructor(props: Props) { - super(props); - makeObservable(this); - } - @autobind() confirmRemoveCluster() { const { cluster } = this.props; diff --git a/src/renderer/navigation/page-param.ts b/src/renderer/navigation/page-param.ts index 040efcfce2..d6d93f4813 100644 --- a/src/renderer/navigation/page-param.ts +++ b/src/renderer/navigation/page-param.ts @@ -1,6 +1,6 @@ // Manage observable param from document's location.search import type { ObservableHistory } from "mobx-observable-history"; -import { action, computed, makeObservable } from "mobx"; +import { action, makeObservable } from "mobx"; export interface PageParamInit { name: string; @@ -81,7 +81,7 @@ export class PageParam { /** * Get stringified raw value(s) from `document.location.search` */ - @computed getRaw(): string | string[] { + getRaw(): string | string[] { const values: string[] = this.history.searchParams.getAll(this.name); return this.isMulti ? values : values[0];