From 8eb418d9f7299bd256f2b2b7e6b19bcfc8cfca6c Mon Sep 17 00:00:00 2001 From: brysonjbest <103070659+brysonjbest@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:17:03 -0800 Subject: [PATCH] Fix version display issue. --- app/components/VersionBar/VersionBar.tsx | 2 +- app/rule/[ruleId]/page.tsx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) 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