Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make base store non Singleton #6690

Merged
merged 118 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
257082e
Remove Singleton from BaseStore to remove global shared state
Nokel81 Nov 16, 2022
9fee31a
Remove more usages of Singleton
Nokel81 Nov 17, 2022
4c1e1ac
Replace use of legacy global execHelm with injectable
Nokel81 Nov 30, 2022
1c277a9
Remove last use of legacy global execHelm
Nokel81 Nov 30, 2022
3dce6f9
Extract BaseStore deps into constructor argument
Nokel81 Nov 30, 2022
ad814eb
Introduce method to make store migrations injectable
Nokel81 Nov 30, 2022
1aa3e46
Switch HotbarStore to injectable migrations
Nokel81 Nov 30, 2022
3958e61
Switch UserStore to injectable migrations
Nokel81 Nov 30, 2022
6620bb5
Move migration utils into common/utils/
Nokel81 Nov 30, 2022
a55cd67
Switch WeblinkStore to injectable migrations
Nokel81 Nov 30, 2022
8462364
Remove dead code
Nokel81 Nov 30, 2022
a4ae7c0
Fix type error in base-store tests
Nokel81 Nov 30, 2022
303a397
Remove tests that reference lastSeenVersion
Nokel81 Nov 30, 2022
bd47377
Remove usage of legacy global .getInstance
Nokel81 Dec 1, 2022
21039e2
Remove usage of legacy global ClusterStore.getInstance
Nokel81 Dec 1, 2022
39d3825
Add simple migrations dependency for stores without any preexisting m…
Nokel81 Dec 1, 2022
5a1fd72
Fix messed up import
Nokel81 Dec 1, 2022
ace5673
Add typing to transient injectable
Nokel81 Dec 1, 2022
33e7631
Cleanup formatting
Nokel81 Dec 1, 2022
0cf9f9e
Fix typing in tests to satisfy requirement to have cacheFile
Nokel81 Dec 1, 2022
8217ad4
More consistent use of BaseStore.displayName
Nokel81 Dec 1, 2022
8410a82
Add catching of error while starting main application
Nokel81 Dec 1, 2022
0460db2
Move initializing sentry to runnable
Nokel81 Dec 1, 2022
f9084bc
Remove unneeded appPathsInjectionToken
Nokel81 Dec 1, 2022
5b80dfc
Add support for multiple "runAfter" runnables
Nokel81 Dec 1, 2022
ed99f24
Use multiple runAfter support to fix crash on renderer
Nokel81 Dec 1, 2022
4feff54
Remove traces
Nokel81 Dec 1, 2022
570d252
Add global override to fix tests
Nokel81 Dec 1, 2022
9dbc6bc
Fix base store tests
Nokel81 Dec 1, 2022
bbf6ec3
Fix runManyFor tests
Nokel81 Dec 1, 2022
c4a8604
Fix hotbar store tests
Nokel81 Dec 1, 2022
59657fc
Fix user store tests
Nokel81 Dec 1, 2022
bea52f9
Add global override for getConfigurationFileModel to fix tests
Nokel81 Dec 2, 2022
6cc89bf
Remove overrides for configuration stores
Nokel81 Dec 2, 2022
8d55a3a
Overhaul FS fakes with full in-memory filesystem
Nokel81 Dec 2, 2022
906172b
Remove use of global shared Electron.App
Nokel81 Dec 2, 2022
f7c3657
Add fake access support
Nokel81 Dec 2, 2022
af48b7d
Handle copy as part of fake FS
Nokel81 Dec 2, 2022
8409d56
Add ensureDir/Sync support to fake FS
Nokel81 Dec 2, 2022
06f4802
Fix type error
Nokel81 Dec 2, 2022
e10be8a
Use pathExistsSync instead of fsInjectable
Nokel81 Dec 2, 2022
69cfe9a
Add createReadStream to fake FS
Nokel81 Dec 2, 2022
36063d8
Add stat to fake FS
Nokel81 Dec 2, 2022
4875f24
Remove dead code
Nokel81 Dec 2, 2022
cf0ca41
Fix test failures due to incomplete overrides
Nokel81 Dec 2, 2022
01d3914
Fully injectable-ize BaseStore so that ApplicationBuilder tests work
Nokel81 Dec 2, 2022
9e1d182
Consolidate more bootstrapping into startFrame
Nokel81 Dec 5, 2022
0cad3e7
Move initializing CatalogCategories to runnable in bootstrap
Nokel81 Dec 5, 2022
d585b09
Convert contextMenuOpen initializers into runnables
Nokel81 Dec 5, 2022
659b63d
Convert navigateForExtension init to runnable
Nokel81 Dec 5, 2022
f7b5ae7
Make cluster state sync fully injectable
Nokel81 Dec 5, 2022
56c78c8
Move init hotbar store into runnables
Nokel81 Dec 5, 2022
963651e
Make LensTheme fully injectable and runnable
Nokel81 Dec 5, 2022
621ca72
Cleanup old code from missed from previous commit
Nokel81 Dec 5, 2022
8b9a9ab
Manually split out terminal color names and fully type LensTheme
Nokel81 Dec 5, 2022
76931f8
Fix old imports
Nokel81 Dec 5, 2022
6f4ddf7
Remove unnecessart awaits
Nokel81 Dec 5, 2022
866a69e
Remove dead code
Nokel81 Dec 5, 2022
9877f99
Fully cherry pick injectablizing custom monaco themes
Nokel81 Dec 5, 2022
5d39fe5
Fix duplicate mock warning
Nokel81 Dec 5, 2022
41a9957
Fix incorrectly fully cherry picking new runnable
Nokel81 Dec 5, 2022
ff54c04
Complete cherry-pick of current cluster injcetablization
Nokel81 Dec 5, 2022
26af59a
Fix override file name
Nokel81 Dec 5, 2022
8ad761b
Fix injecting before app paths are set up
Nokel81 Dec 5, 2022
7c22111
Fix injecting before app paths are set up
Nokel81 Dec 5, 2022
83bb5c3
Fix ordering of runnable and order of injection
Nokel81 Dec 5, 2022
c68a1bf
Convert all renderer runnables to late-inject style
Nokel81 Dec 5, 2022
c6c2bb9
Fix react-beautiful-dnd mocks
Nokel81 Dec 5, 2022
618d0d8
Update and fix WriteJson(Sync) to fix error in tests
Nokel81 Dec 5, 2022
ca49e58
Fix HotbarStore.load being called twice is being buggy
Nokel81 Dec 5, 2022
ee33cc9
Update listing-active-helm-repositories-in-preferences snapshots
Nokel81 Dec 5, 2022
8de3e75
Fix sidebar-and-tab-navigation-tests
Nokel81 Dec 5, 2022
e4adc3f
Remove props from dnd mock to make snapshot diffs smaller
Nokel81 Dec 5, 2022
6e7655b
Fix import
Nokel81 Dec 5, 2022
cecc8b9
Update snapshots
Nokel81 Dec 5, 2022
6c06116
Fix tests by overriding things that are no longer overriden by default
Nokel81 Dec 5, 2022
e414fba
Fix hotbar store tests
Nokel81 Dec 5, 2022
c23d3e3
Fix cluster store tests
Nokel81 Dec 5, 2022
551172b
Fix extension-loader tests
Nokel81 Dec 5, 2022
c2f6aed
Fix extension-discovery tests
Nokel81 Dec 5, 2022
808af58
Fix cluster-role-dialog tests
Nokel81 Dec 5, 2022
62cc4ef
Fix user store tests
Nokel81 Dec 5, 2022
8d88f4d
Fix kubeconfig sync tests
Nokel81 Dec 5, 2022
0578093
Fix sidebar and tab tests
Nokel81 Dec 5, 2022
bae2aa0
Remove unused code
Nokel81 Dec 6, 2022
a81873f
Fix pick paths import type error and simplify signature
Nokel81 Dec 6, 2022
177d364
Fix type error in legacy ipc registration
Nokel81 Dec 6, 2022
a33b3cd
Remove another use of legacy requestOpenPathPicker
Nokel81 Dec 6, 2022
b879606
Replace use of legacy global PathPicker.Pick
Nokel81 Dec 6, 2022
d724c4b
Fix usage in light of changed prop names
Nokel81 Dec 6, 2022
1a4c1d8
Fix catalog tests
Nokel81 Dec 6, 2022
a6d1b7a
Fix more type errors
Nokel81 Dec 6, 2022
f95ed19
Fix test flakiness by removing side effects from userStore preferences
Nokel81 Dec 6, 2022
3eabad4
Update snapshots
Nokel81 Dec 6, 2022
318d7fb
Fix loading
Nokel81 Dec 6, 2022
2217b68
Fix type error
Nokel81 Dec 6, 2022
dcd82ad
Fix crash
Nokel81 Dec 6, 2022
1a8040e
Cherry pick updated startFrameInjectable
Nokel81 Dec 6, 2022
29a35ab
Add tests to verify runMany behaviour in new possible incorrect confi…
Nokel81 Dec 9, 2022
731aec1
Fix init ordering during start frame
Nokel81 Dec 9, 2022
ec42d10
Fix cluster state sync
Nokel81 Dec 9, 2022
cda5ada
Update snapshots after removing side-effects
Nokel81 Dec 9, 2022
afac253
Add override for technical test
Nokel81 Dec 9, 2022
8acb457
Correctly mark currentlyInClusterFrame as causedSideEffects
Nokel81 Dec 9, 2022
da7387a
Better formatting
Nokel81 Dec 9, 2022
c429509
Fix behaviour regression
Nokel81 Dec 9, 2022
33b9597
Add better logging
Nokel81 Dec 9, 2022
aec860a
Fix BaseStore sync
Nokel81 Dec 9, 2022
a6c3d81
Fix tests
Nokel81 Dec 9, 2022
b8d5e41
Update last snapshot
Nokel81 Dec 10, 2022
26b10b8
Merge remote-tracking branch 'origin/master' into make-BaseStore-non-…
Nokel81 Dec 12, 2022
bbb610e
Add global override for randomBytes
Nokel81 Dec 12, 2022
f43757e
Make startMainApplication not an injection time side effect
Nokel81 Dec 14, 2022
8416d96
Choose better names for start-frame runnable tokens
Nokel81 Dec 14, 2022
7b8e97b
Remove duplication of code in RunManyFor
Nokel81 Dec 14, 2022
fcddf44
Add unit tests and fix handling empty runAfter array
Nokel81 Dec 14, 2022
4dbf5c8
Replace use of mobx from runManyFor with custom barrier
Nokel81 Dec 14, 2022
c06430f
Add missing test
Nokel81 Dec 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 0 additions & 14 deletions __mocks__/monaco-editor.ts

This file was deleted.

44 changes: 42 additions & 2 deletions __mocks__/react-beautiful-dnd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,49 @@ import React from "react";
import type {
DragDropContextProps,
DraggableProps,
DraggableProvidedDraggableProps,
DroppableProps,
DroppableProvidedProps,
} from "react-beautiful-dnd";

export const DragDropContext = ({ children }: DragDropContextProps) => <>{ children }</>;
export const Draggable = ({ children }: DraggableProps) => <>{ children({} as any, {} as any, {} as any) }</>;
export const Droppable = ({ children }: DroppableProps) => <>{ children({} as any, {} as any) }</>;
export const Draggable = ({ children }: DraggableProps) => (
<>
{
children(
{
draggableProps: {} as DraggableProvidedDraggableProps,
innerRef: () => {},
},
{
isDragging: false,
isDropAnimating: false,
},
{
draggableId: "some-mock-draggable-id",
mode: "FLUID",
source: {
droppableId: "some-mock-droppable-id",
index: 0,
},
},
)
}
</>
);
export const Droppable = ({ children }: DroppableProps) => (
<>
{
children(
{
droppableProps: {} as DroppableProvidedProps,
innerRef: () => {},
},
{
isDraggingOver: false,
isUsingPlaceholder: false,
},
)
}
</>
);
31 changes: 0 additions & 31 deletions build/build_theme_vars.ts

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
"grapheme-splitter": "^1.0.4",
"handlebars": "^4.7.7",
"history": "^4.10.1",
"hpagent": "^1.2.0",
"http-proxy": "^1.18.1",
"immer": "^9.0.16",
"joi": "^17.7.0",
Expand Down
148 changes: 0 additions & 148 deletions src/common/__tests__/base-store.test.ts

This file was deleted.

38 changes: 15 additions & 23 deletions src/common/__tests__/cluster-store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ describe("cluster-store", () => {
mainDi.override(normalizedPlatformInjectable, () => "darwin");

mainDi.permitSideEffects(getConfigurationFileModelInjectable);
mainDi.permitSideEffects(clusterStoreInjectable);
mainDi.permitSideEffects(fsInjectable);
mainDi.unoverride(getConfigurationFileModelInjectable);

mainDi.unoverride(clusterStoreInjectable);
mainDi.permitSideEffects(fsInjectable);
});

afterEach(() => {
Expand All @@ -107,23 +106,19 @@ describe("cluster-store", () => {
let getCustomKubeConfigDirectory: (directoryName: string) => string;

beforeEach(async () => {
getCustomKubeConfigDirectory = mainDi.inject(
getCustomKubeConfigDirectoryInjectable,
);
getCustomKubeConfigDirectory = mainDi.inject(getCustomKubeConfigDirectoryInjectable);

const mockOpts = {
mockFs({
"some-directory-for-user-data": {
"lens-cluster-store.json": JSON.stringify({}),
},
};

mockFs(mockOpts);
});

createCluster = mainDi.inject(createClusterInjectionToken);

clusterStore = mainDi.inject(clusterStoreInjectable);

clusterStore.unregisterIpcListener();
clusterStore.load();
});

afterEach(() => {
Expand Down Expand Up @@ -207,7 +202,7 @@ describe("cluster-store", () => {

describe("config with existing clusters", () => {
beforeEach(() => {
const mockOpts = {
mockFs({
"temp-kube-config": kubeconfig,
"some-directory-for-user-data": {
"lens-cluster-store.json": JSON.stringify({
Expand Down Expand Up @@ -241,13 +236,12 @@ describe("cluster-store", () => {
],
}),
},
};

mockFs(mockOpts);
});

createCluster = mainDi.inject(createClusterInjectionToken);

clusterStore = mainDi.inject(clusterStoreInjectable);
clusterStore.load();
});

afterEach(() => {
Expand Down Expand Up @@ -297,7 +291,7 @@ users:
token: kubeconfig-user-q4lm4:xxxyyyy
`;

const mockOpts = {
mockFs({
"invalid-kube-config": invalidKubeconfig,
"valid-kube-config": kubeconfig,
"some-directory-for-user-data": {
Expand Down Expand Up @@ -325,13 +319,12 @@ users:
],
}),
},
};

mockFs(mockOpts);
});

createCluster = mainDi.inject(createClusterInjectionToken);

clusterStore = mainDi.inject(clusterStoreInjectable);
clusterStore.load();
});

afterEach(() => {
Expand All @@ -347,7 +340,7 @@ users:

describe("pre 3.6.0-beta.1 config with an existing cluster", () => {
beforeEach(() => {
const mockOpts = {
mockFs({
"some-directory-for-user-data": {
"lens-cluster-store.json": JSON.stringify({
__internal__: {
Expand All @@ -368,15 +361,14 @@ users:
}),
icon_path: testDataIcon,
},
};

mockFs(mockOpts);
});

mainDi.override(storeMigrationVersionInjectable, () => "3.6.0");

createCluster = mainDi.inject(createClusterInjectionToken);

clusterStore = mainDi.inject(clusterStoreInjectable);
clusterStore.load();
});

afterEach(() => {
Expand Down
Loading