mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix: cluster-settings page back-button navigation is broken (#2330)
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
7d1b5e4627
commit
c815396622
@ -138,13 +138,12 @@ export class WindowManager extends Singleton {
|
|||||||
|
|
||||||
async navigate(url: string, frameId?: number) {
|
async navigate(url: string, frameId?: number) {
|
||||||
await this.ensureMainWindow();
|
await this.ensureMainWindow();
|
||||||
let frameInfo: ClusterFrameInfo;
|
|
||||||
|
|
||||||
if (frameId) {
|
const frameInfo = Array.from(clusterFrameMap.values()).find((frameInfo) => frameInfo.frameId === frameId);
|
||||||
frameInfo = Array.from(clusterFrameMap.values()).find((frameInfo) => frameInfo.frameId === frameId);
|
const channel = frameInfo ? "renderer:navigate-in-cluster" : "renderer:navigate";
|
||||||
}
|
|
||||||
this.sendToView({
|
this.sendToView({
|
||||||
channel: "renderer:navigate",
|
channel,
|
||||||
frameInfo,
|
frameInfo,
|
||||||
data: [url],
|
data: [url],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,22 +10,37 @@ export function bindEvents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process.isMainFrame) {
|
if (process.isMainFrame) {
|
||||||
// Keep track of active cluster-id for handling IPC/menus/etc.
|
bindClusterManagerRouteEvents();
|
||||||
reaction(() => getMatchedClusterId(), clusterId => {
|
} else {
|
||||||
broadcastMessage("cluster-view:current-id", clusterId);
|
bindClusterFrameRouteEvents();
|
||||||
}, {
|
|
||||||
fireImmediately: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle navigation via IPC (e.g. from top menu)
|
|
||||||
subscribeToBroadcast("renderer:navigate", (event, url: string) => {
|
|
||||||
logger.info(`[IPC]: ${event.type} ${JSON.stringify(url)}`, event);
|
|
||||||
navigate(url);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Reload dashboard window
|
// Reload dashboard window
|
||||||
subscribeToBroadcast("renderer:reload", () => {
|
subscribeToBroadcast("renderer:reload", () => {
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle events only in main window renderer process (see also: cluster-manager.tsx)
|
||||||
|
function bindClusterManagerRouteEvents() {
|
||||||
|
// Keep track of active cluster-id for handling IPC/menus/etc.
|
||||||
|
reaction(() => getMatchedClusterId(), clusterId => {
|
||||||
|
broadcastMessage("cluster-view:current-id", clusterId);
|
||||||
|
}, {
|
||||||
|
fireImmediately: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle navigation via IPC
|
||||||
|
subscribeToBroadcast("renderer:navigate", (event, url: string) => {
|
||||||
|
logger.info(`[IPC]: ${event.type}: ${url}`, { currentLocation: location.href });
|
||||||
|
navigate(url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle cluster-view renderer process events within iframes
|
||||||
|
function bindClusterFrameRouteEvents() {
|
||||||
|
subscribeToBroadcast("renderer:navigate-cluster-view", (event, url: string) => {
|
||||||
|
logger.info(`[IPC]: ${event.type}: ${url}`, { currentLocation: location.href });
|
||||||
|
navigate(url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user