diff --git a/src/presentation/web/src/hooks.client.ts b/src/presentation/web/src/hooks.client.ts index f7fe6fae1..daaa0bb8b 100644 --- a/src/presentation/web/src/hooks.client.ts +++ b/src/presentation/web/src/hooks.client.ts @@ -1,8 +1,7 @@ import { env } from "$env/dynamic/public"; -import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit"; -import * as Sentry from "@sentry/sveltekit"; +import { getClient, handleErrorWithSentry, init } from "@sentry/sveltekit"; -Sentry.init({ +init({ dsn: env.PUBLIC_SENTRY_DSN, tracesSampleRate: 1.0, @@ -18,8 +17,7 @@ Sentry.init({ // sessions when an error occurs. replaysOnErrorSampleRate: 1.0, - // If you don't want to use Session Replay, just remove the line below: - integrations: [replayIntegration()], + // Session Replay is added lazily below instead of listed here -- see loadReplay(). dataCollection: { // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit: @@ -29,5 +27,30 @@ Sentry.init({ }, }); +// Session Replay is one of the heaviest parts of the Sentry SDK. Referencing `replayIntegration` +// only inside this dynamic import (never via a static import elsewhere in this file) keeps it out +// of the eagerly-loaded entry chunk that every page load has to parse and execute -- it ends up in +// its own chunk, fetched only once the page has settled. This doesn't change which sessions +// actually get recorded, since that's still governed by replaysSessionSampleRate/ +// replaysOnErrorSampleRate above, read whenever the integration is added. +// +// Trade-off: Replay isn't active until this runs, so a page view that ends (tab closed, +// navigated away) before then produces no replay and no replaysOnErrorSampleRate coverage for +// errors thrown in that window. Accepted deliberately -- reducing parse/eval cost for every +// visitor outweighs replay coverage for the rare very-short-lived view. +function loadReplay() { + import("@sentry/sveltekit").then(({ replayIntegration }) => { + getClient()?.addIntegration(replayIntegration()); + }); +} + +if (typeof requestIdleCallback === "function") { + // timeout ensures this still fires under continuous page activity, where an idle period may + // otherwise never occur -- matching the setTimeout fallback's 4s bound below. + requestIdleCallback(loadReplay, { timeout: 4000 }); +} else { + setTimeout(loadReplay, 4000); +} + // If you have a custom error handler, pass it to `handleErrorWithSentry` export const handleError = handleErrorWithSentry(); diff --git a/src/presentation/web/src/lib/assets/ranking/mini/1.webp b/src/presentation/web/src/lib/assets/ranking/mini/1.webp new file mode 100644 index 000000000..bd04923a1 Binary files /dev/null and b/src/presentation/web/src/lib/assets/ranking/mini/1.webp differ diff --git a/src/presentation/web/src/lib/assets/ranking/mini/10.webp b/src/presentation/web/src/lib/assets/ranking/mini/10.webp new file mode 100644 index 000000000..ce82b505b Binary files /dev/null and b/src/presentation/web/src/lib/assets/ranking/mini/10.webp differ diff --git a/src/presentation/web/src/lib/assets/ranking/mini/2.webp b/src/presentation/web/src/lib/assets/ranking/mini/2.webp new file mode 100644 index 000000000..b522cc204 Binary files /dev/null and b/src/presentation/web/src/lib/assets/ranking/mini/2.webp differ diff --git a/src/presentation/web/src/lib/assets/ranking/mini/3.webp b/src/presentation/web/src/lib/assets/ranking/mini/3.webp new file mode 100644 index 000000000..ab956fb3f Binary files /dev/null and b/src/presentation/web/src/lib/assets/ranking/mini/3.webp differ diff --git a/src/presentation/web/src/lib/assets/ranking/mini/30.webp b/src/presentation/web/src/lib/assets/ranking/mini/30.webp new file mode 100644 index 000000000..e066017b3 Binary files /dev/null and b/src/presentation/web/src/lib/assets/ranking/mini/30.webp differ diff --git a/src/presentation/web/src/lib/assets/ranking/mini/50.webp b/src/presentation/web/src/lib/assets/ranking/mini/50.webp new file mode 100644 index 000000000..5d0f2a4e5 Binary files /dev/null and b/src/presentation/web/src/lib/assets/ranking/mini/50.webp differ diff --git a/src/presentation/web/src/lib/components/Guild/Icon.svelte b/src/presentation/web/src/lib/components/Guild/Icon.svelte index 91ebd5207..408fa9287 100644 --- a/src/presentation/web/src/lib/components/Guild/Icon.svelte +++ b/src/presentation/web/src/lib/components/Guild/Icon.svelte @@ -1,10 +1,10 @@