mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix pod logs dock tab (#4738)
- Move all dependencies into a transient LogsViewModel - Remove dependencies on dockStore.selectedTab - Make all bindings as late as possible, as per mobx rules Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
b037c3bf02
commit
b3df5b4fc6
42 files changed
+646
-640
No files matched your search
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import dockStoreInjectable from "../components/dock/dock-store/dock-store.injectable";
|
||||
import { SearchStore } from "./search-store";
|
||||
|
||||
const searchStoreInjectable = getInjectable({
|
||||
instantiate: (di) => new SearchStore({
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
export default searchStoreInjectable;
|
||||
@@ -7,7 +7,6 @@ import { SearchStore } from "./search-store";
|
||||
import { Console } from "console";
|
||||
import { stdout, stderr } from "process";
|
||||
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
||||
import searchStoreInjectable from "./search-store.injectable";
|
||||
import directoryForUserDataInjectable
|
||||
from "../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
|
||||
@@ -35,7 +34,7 @@ describe("search store tests", () => {
|
||||
|
||||
await di.runSetups();
|
||||
|
||||
searchStore = di.inject(searchStoreInjectable);
|
||||
searchStore = new SearchStore();
|
||||
});
|
||||
|
||||
it("does nothing with empty search query", () => {
|
||||
|
||||
@@ -3,14 +3,9 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { action, computed, observable, reaction, makeObservable } from "mobx";
|
||||
import type { DockStore } from "../components/dock/dock-store/dock.store";
|
||||
import { action, computed, observable, makeObservable } from "mobx";
|
||||
import { boundMethod } from "../utils";
|
||||
|
||||
interface Dependencies {
|
||||
dockStore: DockStore
|
||||
}
|
||||
|
||||
export class SearchStore {
|
||||
/**
|
||||
* An utility methods escaping user string to safely pass it into new Regex(variable)
|
||||
@@ -41,11 +36,8 @@ export class SearchStore {
|
||||
*/
|
||||
@observable activeOverlayIndex = -1;
|
||||
|
||||
constructor(dependencies: Dependencies) {
|
||||
constructor() {
|
||||
makeObservable(this);
|
||||
reaction(() => dependencies.dockStore.selectedTabId, () => {
|
||||
this.reset();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user