Skip to content

Commit

Permalink
Merge branch 'main' into andrew/validation-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Dickinson authored Nov 29, 2024
2 parents 35cc0b2 + de04e79 commit 926c274
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/lib/EnvThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export const EnvThemeProvider: React.FC<EnvThemeProviderProps> = ({
const env = useEnvContext();

let theme = localTheme;
if (env?.includes("prod")) {
if (env === undefined) {
// This is the case where we haven't loaded the env var from the backend yet. We use prod themes here to prevent
// a flicker in prod before the env vars load from the backend. The other stages will flicker but that's fine
// Once we have any comms with the backend, env will be "" instead, so if the env var is unset we will use localTheme
theme = prodTheme;
} else if (env?.includes("prod")) {
theme = prodTheme;
} else if (env?.includes("dev")) {
theme = devTheme;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export async function getRecaptchaKeys() {

// Literally just ask the server what env we're in
export async function getEnvironment() {
return process.env.MESHFORMS_ENVIRONMENT;
return process.env.MESHFORMS_ENVIRONMENT ?? "";
}

0 comments on commit 926c274

Please sign in to comment.