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

mobx 6.2.0

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-04-13 12:16:03 +03:00
parent bbfad2f35f
commit 2eb512a85c
12 changed files with 23 additions and 23 deletions

View File

@ -218,7 +218,7 @@
"mac-ca": "^1.0.4", "mac-ca": "^1.0.4",
"marked": "^1.2.7", "marked": "^1.2.7",
"md5-file": "^5.0.0", "md5-file": "^5.0.0",
"mobx": "^5.15.7", "mobx": "^6.2.0",
"mobx-observable-history": "^1.0.3", "mobx-observable-history": "^1.0.3",
"mobx-react": "^6.2.2", "mobx-react": "^6.2.2",
"mock-fs": "^4.12.0", "mock-fs": "^4.12.0",

View File

@ -295,7 +295,7 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
@action @action
protected fromStore({ activeCluster, clusters = [] }: ClusterStoreModel = {}) { protected fromStore({ activeCluster, clusters = [] }: ClusterStoreModel = {}) {
const currentClusters = this.clusters.toJS(); const currentClusters = toJS(this.clusters);
const newClusters = new Map<ClusterId, Cluster>(); const newClusters = new Map<ClusterId, Cluster>();
const removedClusters = new Map<ClusterId, Cluster>(); const removedClusters = new Map<ClusterId, Cluster>();

View File

@ -41,7 +41,7 @@ export class ExtensionLoader {
whenLoaded = when(() => this.isLoaded); whenLoaded = when(() => this.isLoaded);
@computed get userExtensions(): Map<LensExtensionId, InstalledExtension> { @computed get userExtensions(): Map<LensExtensionId, InstalledExtension> {
const extensions = this.extensions.toJS(); const extensions = toJS(this.extensions);
extensions.forEach((ext, extId) => { extensions.forEach((ext, extId) => {
if (ext.isBundled) { if (ext.isBundled) {
@ -55,7 +55,7 @@ export class ExtensionLoader {
@computed get userExtensionsByName(): Map<string, LensExtension> { @computed get userExtensionsByName(): Map<string, LensExtension> {
const extensions = new Map(); const extensions = new Map();
for (const [, val] of this.instances.toJS()) { for (const [, val] of toJS(this.instances)) {
if (val.isBundled) { if (val.isBundled) {
continue; continue;
} }

View File

@ -3,7 +3,7 @@ import "./release-details.scss";
import React, { Component } from "react"; import React, { Component } from "react";
import groupBy from "lodash/groupBy"; import groupBy from "lodash/groupBy";
import isEqual from "lodash/isEqual"; import isEqual from "lodash/isEqual";
import { observable, reaction } from "mobx"; import { observable, reaction, toJS } from "mobx";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import kebabCase from "lodash/kebabCase"; import kebabCase from "lodash/kebabCase";
import { HelmRelease, helmReleasesApi, IReleaseDetails } from "../../api/endpoints/helm-releases.api"; import { HelmRelease, helmReleasesApi, IReleaseDetails } from "../../api/endpoints/helm-releases.api";
@ -48,7 +48,7 @@ export class ReleaseDetails extends Component<Props> {
); );
@disposeOnUnmount @disposeOnUnmount
secretWatcher = reaction(() => secretsStore.items.toJS(), () => { secretWatcher = reaction(() => toJS(secretsStore.items), () => {
if (!this.props.release) return; if (!this.props.release) return;
const { getReleaseSecret } = releaseStore; const { getReleaseSecret } = releaseStore;
const { release } = this.props; const { release } = this.props;

View File

@ -1,5 +1,5 @@
import isEqual from "lodash/isEqual"; import isEqual from "lodash/isEqual";
import { action, IReactionDisposer, observable, reaction, when } from "mobx"; import { action, IReactionDisposer, observable, reaction, toJS, when } from "mobx";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { HelmRelease, helmReleasesApi, IReleaseCreatePayload, IReleaseUpdatePayload } from "../../api/endpoints/helm-releases.api"; import { HelmRelease, helmReleasesApi, IReleaseCreatePayload, IReleaseUpdatePayload } from "../../api/endpoints/helm-releases.api";
import { ItemStore } from "../../item.store"; import { ItemStore } from "../../item.store";
@ -21,7 +21,7 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
} }
watch() { watch() {
this.secretWatcher = reaction(() => secretsStore.items.toJS(), () => { this.secretWatcher = reaction(() => toJS(secretsStore.items), () => {
if (this.isLoading) return; if (this.isLoading) return;
const secrets = this.getReleaseSecrets(); const secrets = this.getReleaseSecrets();
const amountChanged = secrets.length !== this.releaseSecrets.length; const amountChanged = secrets.length !== this.releaseSecrets.length;

View File

@ -1,4 +1,4 @@
import { computed, reaction } from "mobx"; import { computed, reaction, toJS } from "mobx";
import { KubeObjectStore } from "../../kube-object.store"; import { KubeObjectStore } from "../../kube-object.store";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { crdApi, CustomResourceDefinition } from "../../api/endpoints/crd.api"; import { crdApi, CustomResourceDefinition } from "../../api/endpoints/crd.api";
@ -26,7 +26,7 @@ export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
super(); super();
// auto-init stores for crd-s // auto-init stores for crd-s
reaction(() => this.items.toJS(), items => items.forEach(initStore)); reaction(() => toJS(this.items), items => items.forEach(initStore));
} }
protected sortItems(items: CustomResourceDefinition[]) { protected sortItems(items: CustomResourceDefinition[]) {

View File

@ -1,6 +1,6 @@
import { useState } from "react"; import { useState } from "react";
import { createStorage } from "../utils"; import { createStorage } from "../utils";
import { CreateObservableOptions } from "mobx/lib/api/observable"; import { CreateObservableOptions } from "mobx";
export function useStorage<T>(key: string, initialValue: T, options?: CreateObservableOptions) { export function useStorage<T>(key: string, initialValue: T, options?: CreateObservableOptions) {
const storage = createStorage(key, initialValue, options); const storage = createStorage(key, initialValue, options);

View File

@ -1,6 +1,6 @@
import orderBy from "lodash/orderBy"; import orderBy from "lodash/orderBy";
import { autobind, noop } from "./utils"; import { autobind, noop } from "./utils";
import { action, computed, observable, when } from "mobx"; import { action, computed, observable, toJS, when } from "mobx";
export interface ItemObject { export interface ItemObject {
getId(): string; getId(): string;
@ -23,7 +23,7 @@ export abstract class ItemStore<T extends ItemObject = ItemObject> {
} }
public getItems(): T[] { public getItems(): T[] {
return this.items.toJS(); return toJS(this.items);
} }
public getTotalCount(): number { public getTotalCount(): number {

View File

@ -1,4 +1,4 @@
import { reaction } from "mobx"; import { reaction, toJS } from "mobx";
import { StorageAdapter, StorageHelper } from "../storageHelper"; import { StorageAdapter, StorageHelper } from "../storageHelper";
import { delay } from "../../../common/utils/delay"; import { delay } from "../../../common/utils/delay";
@ -166,7 +166,7 @@ describe("renderer/utils/StorageHelper", () => {
it("storage.get() is observable", () => { it("storage.get() is observable", () => {
expect(storageHelper.get()).toEqual(defaultValue); expect(storageHelper.get()).toEqual(defaultValue);
reaction(() => storageHelper.toJS(), change => { reaction(() => toJS(storageHelper), change => {
observedChanges.push(change); observedChanges.push(change);
}); });

View File

@ -1,6 +1,6 @@
// Keeps window.localStorage state in external JSON-files. // Keeps window.localStorage state in external JSON-files.
// Because app creates random port between restarts => storage session wiped out each time. // Because app creates random port between restarts => storage session wiped out each time.
import type { CreateObservableOptions } from "mobx/lib/api/observable"; import type { CreateObservableOptions } from "mobx";
import path from "path"; import path from "path";
import { app, remote } from "electron"; import { app, remote } from "electron";

View File

@ -1,6 +1,6 @@
// Helper for working with storages (e.g. window.localStorage, NodeJS/file-system, etc.) // Helper for working with storages (e.g. window.localStorage, NodeJS/file-system, etc.)
import type { CreateObservableOptions } from "mobx/lib/api/observable"; import type { CreateObservableOptions } from "mobx";
import { action, comparer, observable, toJS, when } from "mobx"; import { action, comparer, observable, toJS, when } from "mobx";
import produce, { Draft, enableMapSet, setAutoFreeze } from "immer"; import produce, { Draft, enableMapSet, setAutoFreeze } from "immer";
import { isEqual, isFunction, isPlainObject } from "lodash"; import { isEqual, isFunction, isPlainObject } from "lodash";

View File

@ -9512,10 +9512,10 @@ mobx@^5.15.4:
resolved "https://registry.yarnpkg.com/mobx/-/mobx-5.15.4.tgz#9da1a84e97ba624622f4e55a0bf3300fb931c2ab" resolved "https://registry.yarnpkg.com/mobx/-/mobx-5.15.4.tgz#9da1a84e97ba624622f4e55a0bf3300fb931c2ab"
integrity sha512-xRFJxSU2Im3nrGCdjSuOTFmxVDGeqOHL+TyADCGbT0k4HHqGmx5u2yaHNryvoORpI4DfbzjJ5jPmuv+d7sioFw== integrity sha512-xRFJxSU2Im3nrGCdjSuOTFmxVDGeqOHL+TyADCGbT0k4HHqGmx5u2yaHNryvoORpI4DfbzjJ5jPmuv+d7sioFw==
mobx@^5.15.7: mobx@^6.2.0:
version "5.15.7" version "6.2.0"
resolved "https://registry.yarnpkg.com/mobx/-/mobx-5.15.7.tgz#b9a5f2b6251f5d96980d13c78e9b5d8d4ce22665" resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.2.0.tgz#9a5afe3525a0302691c7805d0df6ef60834d79e5"
integrity sha512-wyM3FghTkhmC+hQjyPGGFdpehrcX1KOXsDuERhfK2YbJemkUhEB+6wzEN639T21onxlfYBmriA1PFnvxTUhcKw== integrity sha512-j5f16JIq2v4flvYCqaAB9tMtJt/y5efR2OO5Xy+w4/MBMeQ1WeGR0T8BtiNgmxM/OQzPFUKb5DTex9Y8a/yk+g==
mock-fs@^4.12.0: mock-fs@^4.12.0:
version "4.12.0" version "4.12.0"