1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix not starting with sentryDSN configured (#5629)

* Fix not starting with sentryDSN configured

- Make sure that all beforeElectronIsReady runables are run completely
  syncronously

- Fix when setupSentry is to be run (namely before electron is ready)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-06-15 00:38:54 -04:00 committed by GitHub
parent 125277fd81
commit f45627f117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 24 deletions

View File

@ -15,9 +15,7 @@ const di = getDi();
const startApplication = di.inject(startMainApplicationInjectable); const startApplication = di.inject(startMainApplicationInjectable);
(async () => { void startApplication();
await startApplication();
})();
/** /**
* Exports for virtual package "@k8slens/extensions" for main-process. * Exports for virtual package "@k8slens/extensions" for main-process.

View File

@ -5,7 +5,7 @@
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { initializeSentryReporting } from "../../../common/sentry"; import { initializeSentryReporting } from "../../../common/sentry";
import { init } from "@sentry/electron/main"; import { init } from "@sentry/electron/main";
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/before-application-is-loading-injection-token"; import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
const setupSentryInjectable = getInjectable({ const setupSentryInjectable = getInjectable({
id: "setup-sentry", id: "setup-sentry",
@ -18,7 +18,7 @@ const setupSentryInjectable = getInjectable({
causesSideEffects: true, causesSideEffects: true,
injectionToken: beforeApplicationIsLoadingInjectionToken, injectionToken: beforeElectronIsReadyInjectionToken,
}); });
export default setupSentryInjectable; export default setupSentryInjectable;

View File

@ -38,34 +38,36 @@ const startMainApplicationInjectable = getInjectable({
const onLoadOfApplication = runMany(onLoadOfApplicationInjectionToken); const onLoadOfApplication = runMany(onLoadOfApplicationInjectionToken);
const afterApplicationIsLoaded = runMany(afterApplicationIsLoadedInjectionToken); const afterApplicationIsLoaded = runMany(afterApplicationIsLoadedInjectionToken);
return async () => { return () => {
// Stuff happening before application is ready needs to be synchronous because of // Stuff happening before application is ready needs to be synchronous because of
// https://github.com/electron/electron/issues/21370 // https://github.com/electron/electron/issues/21370
beforeElectronIsReady(); beforeElectronIsReady();
await waitForElectronToBeReady(); return (async () => {
await waitForElectronToBeReady();
await beforeApplicationIsLoading(); await beforeApplicationIsLoading();
if (!shouldStartHidden) { if (!shouldStartHidden) {
await splashWindow.show(); await splashWindow.show();
}
await onLoadOfApplication();
if (!shouldStartHidden) {
const deepLinkUrl = getDeepLinkUrl(commandLineArguments);
if (deepLinkUrl) {
await openDeepLink(deepLinkUrl);
} else {
await applicationWindow.show();
} }
splashWindow.close(); await onLoadOfApplication();
}
await afterApplicationIsLoaded(); if (!shouldStartHidden) {
const deepLinkUrl = getDeepLinkUrl(commandLineArguments);
if (deepLinkUrl) {
await openDeepLink(deepLinkUrl);
} else {
await applicationWindow.show();
}
splashWindow.close();
}
await afterApplicationIsLoaded();
})();
}; };
}, },
}); });