mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
3bd484f92a
commit
287147a64d
@ -7,12 +7,9 @@ jest.mock("electron", () => {
|
|||||||
getPath: () => "tmp",
|
getPath: () => "tmp",
|
||||||
getLocale: () => "en"
|
getLocale: () => "en"
|
||||||
},
|
},
|
||||||
ipcRenderer: {
|
|
||||||
invoke: jest.fn(),
|
|
||||||
on: jest.fn()
|
|
||||||
},
|
|
||||||
ipcMain: {
|
ipcMain: {
|
||||||
handle: jest.fn()
|
handle: jest.fn(),
|
||||||
|
on: jest.fn()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -49,9 +49,9 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getState(): WorkspaceState {
|
getState(): WorkspaceState {
|
||||||
return {
|
return toJS({
|
||||||
enabled: this.enabled
|
enabled: this.enabled
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pushState(state = this.getState()) {
|
pushState(state = this.getState()) {
|
||||||
@ -87,21 +87,28 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
|||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
await super.load();
|
await super.load();
|
||||||
|
type workspaceStateSync = {
|
||||||
|
id: string;
|
||||||
|
state: WorkspaceState;
|
||||||
|
};
|
||||||
if (ipcRenderer) {
|
if (ipcRenderer) {
|
||||||
logger.info("[WORKSPACE-STORE] requesting initial state sync");
|
logger.info("[WORKSPACE-STORE] requesting initial state sync");
|
||||||
await requestMain(this.stateRequestChannel, (states: Map<string, WorkspaceState>) => {
|
const workspaceStates: workspaceStateSync[] = await requestMain(this.stateRequestChannel);
|
||||||
states.forEach((state, id) => {
|
console.log(workspaceStates);
|
||||||
const workspace = this.getById(id);
|
workspaceStates.forEach((workspaceState) => {
|
||||||
if (workspace) {
|
const workspace = this.getById(workspaceState.id);
|
||||||
workspace.setState(state);
|
if (workspace) {
|
||||||
}
|
workspace.setState(workspaceState.state);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
handleRequest(this.stateRequestChannel, (): Map<string, WorkspaceState> => {
|
handleRequest(this.stateRequestChannel, (): workspaceStateSync[] => {
|
||||||
const states = new Map<string, WorkspaceState>();
|
const states: workspaceStateSync[] = [];
|
||||||
this.workspacesList.forEach((workspace) => {
|
this.workspacesList.forEach((workspace) => {
|
||||||
states.set(workspace.id, workspace.getState());
|
states.push({
|
||||||
|
state: workspace.getState(),
|
||||||
|
id: workspace.id
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return states;
|
return states;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user