From cb87bf3bee31d2b1a143c612bb1c8b97458bcc58 Mon Sep 17 00:00:00 2001 From: Oksamies Date: Tue, 9 Sep 2025 02:07:18 +0300 Subject: [PATCH 1/3] Add image lazy loading and improve env variable logic --- apps/cyberstorm-remix/app/root.tsx | 43 +++++++++++++++---- .../cyberstorm/security/publicEnvVariables.ts | 16 ++++++- .../src/newComponents/Image/Image.tsx | 4 +- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/apps/cyberstorm-remix/app/root.tsx b/apps/cyberstorm-remix/app/root.tsx index 4ca25fafa..eb091d430 100644 --- a/apps/cyberstorm-remix/app/root.tsx +++ b/apps/cyberstorm-remix/app/root.tsx @@ -182,6 +182,31 @@ const adContainerIds = ["right-column-1", "right-column-2", "right-column-3"]; export function Layout({ children }: { children: React.ReactNode }) { const data = useLoaderData(); + let envVars = undefined; + let shouldUpdatePublicEnvVars = false; + if (import.meta.env.SSR) { + envVars = getPublicEnvVariables([ + "VITE_SITE_URL", + "VITE_BETA_SITE_URL", + "VITE_API_URL", + "VITE_COOKIE_DOMAIN", + "VITE_AUTH_BASE_URL", + "VITE_AUTH_RETURN_URL", + "VITE_CLIENT_SENTRY_DSN", + ]); + shouldUpdatePublicEnvVars = true; + } else { + envVars = window.NIMBUS_PUBLIC_ENV; + if ( + data && + data.publicEnvVariables && + data.publicEnvVariables !== envVars + ) { + shouldUpdatePublicEnvVars = true; + } + } + + const resolvedEnvVars = data ? data.publicEnvVariables : envVars; const location = useLocation(); // const splitPath = location.pathname.split("/"); @@ -237,19 +262,21 @@ export function Layout({ children }: { children: React.ReactNode }) { -