Don't send rageshakes or start sentry if we don't have config for them
This commit is contained in:
parent
fd3c0d9fc6
commit
eaf14a0562
2 changed files with 26 additions and 19 deletions
|
|
@ -191,17 +191,24 @@ export class Initializer {
|
||||||
this.loadStates.sentry === LoadState.None &&
|
this.loadStates.sentry === LoadState.None &&
|
||||||
this.loadStates.config === LoadState.Loaded
|
this.loadStates.config === LoadState.Loaded
|
||||||
) {
|
) {
|
||||||
Sentry.init({
|
if (
|
||||||
dsn: Config.instance.config.sentry?.DSN,
|
Config.instance.config.sentry?.DSN &&
|
||||||
environment: Config.instance.config.sentry?.environment,
|
Config.instance.config.sentry?.environment
|
||||||
integrations: [
|
) {
|
||||||
new Integrations.BrowserTracing({
|
Sentry.init({
|
||||||
routingInstrumentation:
|
dsn: Config.instance.config.sentry?.DSN,
|
||||||
Sentry.reactRouterV5Instrumentation(history),
|
environment: Config.instance.config.sentry?.environment,
|
||||||
}),
|
integrations: [
|
||||||
],
|
new Integrations.BrowserTracing({
|
||||||
tracesSampleRate: 1.0,
|
routingInstrumentation:
|
||||||
});
|
Sentry.reactRouterV5Instrumentation(history),
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
tracesSampleRate: 1.0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Sentry is now 'loadeed' (even if we actually skipped starting
|
||||||
|
// it due to to not being configured)
|
||||||
this.loadStates.sentry = LoadState.Loaded;
|
this.loadStates.sentry = LoadState.Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ export function useSubmitRageshake(): {
|
||||||
|
|
||||||
const submitRageshake = useCallback(
|
const submitRageshake = useCallback(
|
||||||
async (opts) => {
|
async (opts) => {
|
||||||
|
if (!Config.instance.config.rageshake?.submit_url) {
|
||||||
|
throw new Error("No rageshake URL is configured");
|
||||||
|
}
|
||||||
|
|
||||||
if (sending) {
|
if (sending) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -258,14 +262,10 @@ export function useSubmitRageshake(): {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await fetch(
|
await fetch(Config.instance.config.rageshake?.submit_url, {
|
||||||
Config.instance.config.rageshake?.submit_url ??
|
method: "POST",
|
||||||
DEFAULT_CONFIG.rageshake.submit_url,
|
body,
|
||||||
{
|
});
|
||||||
method: "POST",
|
|
||||||
body,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
setState({ sending: false, sent: true, error: null });
|
setState({ sending: false, sent: true, error: null });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue