mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cluster-store-3.6.0 migration regression fix
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
a305b04292
commit
67377af52e
2 files changed
+7
-6
No files matched your search
@@ -74,14 +74,14 @@ export class BaseStore<T = any> extends Singleton {
|
||||
);
|
||||
if (ipcMain) {
|
||||
ipcMain.on(this.syncEvent, (event, model: T) => {
|
||||
logger.info(`[STORE]: ${this.name} sync update from renderer`, model);
|
||||
logger.debug(`[STORE]: ${this.name} sync update from renderer`, model);
|
||||
this.onSync(model);
|
||||
});
|
||||
this.syncDisposers.push(() => ipcMain.removeAllListeners(this.syncEvent));
|
||||
}
|
||||
if (ipcRenderer) {
|
||||
ipcRenderer.on(this.syncEvent, (event, model: T) => {
|
||||
logger.info(`[STORE]: ${this.name} sync update from main`, model);
|
||||
logger.debug(`[STORE]: ${this.name} sync update from main`, model);
|
||||
this.onSync(model);
|
||||
});
|
||||
this.syncDisposers.push(() => ipcRenderer.removeAllListeners(this.syncEvent));
|
||||
@@ -95,18 +95,17 @@ export class BaseStore<T = any> extends Singleton {
|
||||
|
||||
protected onSync(model: T) {
|
||||
if (!isEqual(this.toJSON(), model)) {
|
||||
logger.info(`[STORE]: ${this.name} received update from main`, model);
|
||||
this.fromStore(model);
|
||||
}
|
||||
}
|
||||
|
||||
protected async onModelChange(model: T) {
|
||||
// update views and save to config file
|
||||
if (ipcMain) {
|
||||
broadcastMessage(this.syncEvent, model);
|
||||
broadcastMessage(this.syncEvent, model); // send updates to renderer views
|
||||
|
||||
// fixme: https://github.com/sindresorhus/conf/issues/114
|
||||
Object.entries(model).forEach(([key, value]) => {
|
||||
this.storeConfig.set(key, value);
|
||||
this.storeConfig.set(key, value); // save update to config file
|
||||
});
|
||||
}
|
||||
// sends "update-request" event to main-process
|
||||
|
||||
Reference in new issue
Block a user