From 27875deb441d8a1742b20c48ba3a4b7490e3e3cf Mon Sep 17 00:00:00 2001 From: Matti Nannt Date: Wed, 24 Apr 2024 16:17:24 +0200 Subject: [PATCH] fix: display count in summary only updating with new response (#2524) --- .../[surveyId]/(analysis)/summary/components/SummaryPage.tsx | 4 ---- packages/lib/response/service.ts | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx index ea9deb2caa..1c51441ef0 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx @@ -95,10 +95,6 @@ const SummaryPage = ({ updatedResponseCount = await getResponseCountAction(surveyId, filters); } setResponseCount(updatedResponseCount); - if (updatedResponseCount === 0) { - setSurveySummary(initialSurveySummary); - return; - } let updatedSurveySummary; if (isSharingPage) { diff --git a/packages/lib/response/service.ts b/packages/lib/response/service.ts index db92620a76..72ec2d78a2 100644 --- a/packages/lib/response/service.ts +++ b/packages/lib/response/service.ts @@ -27,6 +27,7 @@ import { TSurveySummary } from "@formbricks/types/surveys"; import { TTag } from "@formbricks/types/tags"; import { ITEMS_PER_PAGE, SERVICES_REVALIDATION_INTERVAL, WEBAPP_URL } from "../constants"; +import { displayCache } from "../display/cache"; import { deleteDisplayByResponseId, getDisplayCountBySurveyId } from "../display/service"; import { createPerson, getPerson, getPersonByUserId, transformPrismaPerson } from "../person/service"; import { @@ -632,7 +633,7 @@ export const getSurveySummary = ( }, [`getSurveySummary-${surveyId}-${JSON.stringify(filterCriteria)}`], { - tags: [responseCache.tag.bySurveyId(surveyId)], + tags: [responseCache.tag.bySurveyId(surveyId), displayCache.tag.bySurveyId(surveyId)], revalidate: SERVICES_REVALIDATION_INTERVAL, } )();