mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix race conditrion preventing window from opening (#6680)
Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
693f6ea9a5
commit
4cb1946110
@ -44,6 +44,11 @@ export interface LensWindowConfiguration {
|
|||||||
windowFrameUtilitiesAreShown: boolean;
|
windowFrameUtilitiesAreShown: boolean;
|
||||||
centered: boolean;
|
centered: boolean;
|
||||||
titleBarStyle?: ElectronWindowTitleBarStyle;
|
titleBarStyle?: ElectronWindowTitleBarStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called before the ContentSource is used and then awaited after
|
||||||
|
* the open call resolves
|
||||||
|
*/
|
||||||
beforeOpen?: () => Promise<void>;
|
beforeOpen?: () => Promise<void>;
|
||||||
onFocus?: () => void;
|
onFocus?: () => void;
|
||||||
onBlur?: () => void;
|
onBlur?: () => void;
|
||||||
@ -93,8 +98,12 @@ const createLensWindowInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { file: filePathForContent, url: urlForContent } =
|
const {
|
||||||
configuration.getContentSource();
|
file: filePathForContent,
|
||||||
|
url: urlForContent,
|
||||||
|
} = configuration.getContentSource();
|
||||||
|
|
||||||
|
const beforeOpen = configuration.beforeOpen?.();
|
||||||
|
|
||||||
if (filePathForContent) {
|
if (filePathForContent) {
|
||||||
await browserWindow.loadFile(filePathForContent);
|
await browserWindow.loadFile(filePathForContent);
|
||||||
@ -102,7 +111,7 @@ const createLensWindowInjectable = getInjectable({
|
|||||||
await browserWindow.loadUrl(urlForContent);
|
await browserWindow.loadUrl(urlForContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
await configuration.beforeOpen?.();
|
await beforeOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
showWindow();
|
showWindow();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user