diff --git a/app/components/VersionBar/VersionBar.tsx b/app/components/VersionBar/VersionBar.tsx index 9a1d0b8..fc4397e 100644 --- a/app/components/VersionBar/VersionBar.tsx +++ b/app/components/VersionBar/VersionBar.tsx @@ -12,7 +12,7 @@ interface VersionBarProps { export default function VersionBar({ ruleInfo, - version = process.env.NEXT_PUBLIC_IN_PRODUCTION ? RULE_VERSION.inProduction : RULE_VERSION.inDev, + version = process.env.NEXT_PUBLIC_IN_PRODUCTION === "true" ? RULE_VERSION.inProduction : RULE_VERSION.inDev, }: VersionBarProps) { const versionColor = getVersionColor(version); diff --git a/app/rule/[ruleId]/page.tsx b/app/rule/[ruleId]/page.tsx index 6f3a385..f2d7aec 100644 --- a/app/rule/[ruleId]/page.tsx +++ b/app/rule/[ruleId]/page.tsx @@ -25,11 +25,10 @@ export async function generateMetadata({ params, searchParams }: Props): Promise } export default async function Rule({ params: { ruleId }, searchParams }: Props) { - const version = searchParams.version?.trim() - ? searchParams.version - : process.env.NEXT_PUBLIC_IN_PRODUCTION - ? RULE_VERSION.inProduction - : RULE_VERSION.inDev; + const defaultVersion = + process.env.NEXT_PUBLIC_IN_PRODUCTION === "true" ? RULE_VERSION.inProduction : RULE_VERSION.inDev; + + const version = searchParams.version?.trim() || defaultVersion; const oAuthRequired = version === RULE_VERSION.draft; // only require oauth if editing a draft // Ensure user is first logged into github so they can save what they edit