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

migration additions -- part 2

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2021-04-19 18:15:48 +03:00
parent 9ca7104a2a
commit 95794af5b2
5 changed files with 18 additions and 5 deletions

13
src/common/libs-config.ts Normal file
View File

@ -0,0 +1,13 @@
// Global configuration setup for external packages.
// Should be imported at the top of app's entry points.
import { configure } from "mobx";
import { enableMapSet, setAutoFreeze } from "immer";
// Mobx
configure({
enforceActions: "never", // allows to skip using @action when class-method updates some state
});
// Immer
setAutoFreeze(false); // allow to merge observables
enableMapSet(); // allow merging maps and sets

View File

@ -1,4 +1,6 @@
import "./common/libs-config";
import fetchMock from "jest-fetch-mock";
// rewire global.fetch to call 'fetchMock'
fetchMock.enableMocks();

View File

@ -1,6 +1,7 @@
// Main process
import "../common/system-ca";
import "../common/libs-config"
import "../common/prometheus-providers";
import * as Mobx from "mobx";
import * as LensExtensions from "../extensions/core-api";

View File

@ -1,5 +1,5 @@
import "./components/app.scss";
import "../common/libs-config";
import React from "react";
import * as Mobx from "mobx";
import * as MobxReact from "mobx-react";

View File

@ -1,13 +1,10 @@
// Helper for working with storages (e.g. window.localStorage, NodeJS/file-system, etc.)
import { action, comparer, CreateObservableOptions, IObservableValue, observable, reaction, toJS, when } from "mobx";
import produce, { Draft, enableMapSet, setAutoFreeze } from "immer";
import produce, { Draft } from "immer";
import { isEqual, isFunction, isPlainObject, merge } from "lodash";
import logger from "../../main/logger";
setAutoFreeze(false); // allow to merge observables
enableMapSet(); // allow merging maps and sets
export interface StorageAdapter<T> {
[metadata: string]: any;
getItem(key: string): T | Promise<T>;