mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix IPC race condition. (#4169)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
parent
6c599556a2
commit
be8e350510
@ -49,6 +49,12 @@ function getSubFrames(): ClusterFrameInfo[] {
|
||||
}
|
||||
|
||||
export function broadcastMessage(channel: string, ...args: any[]) {
|
||||
const subFramesP = ipcRenderer
|
||||
? requestMain(subFramesChannel)
|
||||
: Promise.resolve(getSubFrames());
|
||||
|
||||
subFramesP
|
||||
.then(subFrames => {
|
||||
const views: undefined | ReturnType<typeof webContents.getAllWebContents> | ReturnType<typeof remote.webContents.getAllWebContents> = (webContents || electronRemote?.webContents)?.getAllWebContents();
|
||||
|
||||
if (!views || !Array.isArray(views) || views.length === 0) return;
|
||||
@ -57,12 +63,6 @@ export function broadcastMessage(channel: string, ...args: any[]) {
|
||||
ipcRenderer?.send(channel, ...args);
|
||||
ipcMain?.emit(channel, ...args);
|
||||
|
||||
const subFramesP = ipcRenderer
|
||||
? requestMain(subFramesChannel)
|
||||
: Promise.resolve(getSubFrames());
|
||||
|
||||
subFramesP
|
||||
.then(subFrames => {
|
||||
for (const view of views) {
|
||||
let viewType = "unknown";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user