mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Random fixes (#727)
* extract missing localizations from last master <- pr-merge Signed-off-by: Roman <ixrock@gmail.com> * fix: prevent app-crash in preferences in case of incorrect http-proxy value Signed-off-by: Roman <ixrock@gmail.com> * fix: don't repeat ipc-sync message to main renderer process/window when sending to frames Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
81a0c432c6
commit
6e645eade0
7 files changed
+241
-166
No files matched your search
@@ -132,7 +132,12 @@ export class BaseStore<T = any> extends Singleton {
|
||||
broadcastIpc(msg); // send to all windows (BrowserWindow, webContents)
|
||||
const frames = await this.getSubFrames();
|
||||
frames.forEach(frameId => {
|
||||
broadcastIpc({ frameId, ...msg }); // send to all sub-frames (e.g. cluster-view managed in iframe)
|
||||
// send to all sub-frames (e.g. cluster-view managed in iframe)
|
||||
broadcastIpc({
|
||||
...msg,
|
||||
frameId: frameId,
|
||||
frameOnly: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -54,12 +54,13 @@ export interface IpcBroadcastParams<A extends any[] = any> {
|
||||
channel: IpcChannel
|
||||
webContentId?: number; // send to single webContents view
|
||||
frameId?: number; // send to inner frame of webContents
|
||||
frameOnly?: boolean; // send message only to view with provided `frameId`
|
||||
filter?: (webContent: WebContents) => boolean
|
||||
timeout?: number; // todo: add support
|
||||
args?: A;
|
||||
}
|
||||
|
||||
export function broadcastIpc({ channel, frameId, webContentId, filter, args = [] }: IpcBroadcastParams) {
|
||||
export function broadcastIpc({ channel, frameId, frameOnly, webContentId, filter, args = [] }: IpcBroadcastParams) {
|
||||
const singleView = webContentId ? webContents.fromId(webContentId) : null;
|
||||
let views = singleView ? [singleView] : webContents.getAllWebContents();
|
||||
if (filter) {
|
||||
@@ -68,7 +69,9 @@ export function broadcastIpc({ channel, frameId, webContentId, filter, args = []
|
||||
views.forEach(webContent => {
|
||||
const type = webContent.getType();
|
||||
logger.debug(`[IPC]: broadcasting "${channel}" to ${type}=${webContent.id}`, { args });
|
||||
webContent.send(channel, ...args);
|
||||
if (!frameOnly) {
|
||||
webContent.send(channel, ...args);
|
||||
}
|
||||
if (frameId) {
|
||||
webContent.sendToFrame(frameId, channel, ...args)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user