From a78c19385e7373c49b022bfe840d9ce107ae417f Mon Sep 17 00:00:00 2001 From: Shubham Palriwala Date: Wed, 4 Oct 2023 16:34:47 +0530 Subject: [PATCH] fix: generate single survey Ids in summary only if enabled (#942) --- .../surveys/[surveyId]/(analysis)/summary/page.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx index c5866fb710..c9a4526191 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx @@ -30,7 +30,12 @@ export default async function Page({ params }) { getEnvironment(params.environmentId), ]); const isSingleUseSurvey = survey.singleUse?.enabled ?? false; - const singleUseIds = generateSingleUseIds(survey.singleUse?.isEncrypted ?? false); + + let singleUseIds: string[] | undefined = undefined; + if (isSingleUseSurvey) { + singleUseIds = generateSingleUseIds(survey.singleUse?.isEncrypted ?? false); + } + if (!environment) { throw new Error("Environment not found"); }