From 977ae5e52ca64b516294a529818f0eb1ad84f1ea Mon Sep 17 00:00:00 2001 From: mbthiery Date: Thu, 29 Aug 2024 10:25:39 -0400 Subject: [PATCH] Use static stats for review apps --- src/app/stats/utils/fetchGovernanceMetrics.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/stats/utils/fetchGovernanceMetrics.ts b/src/app/stats/utils/fetchGovernanceMetrics.ts index f47f2ac..4da6a31 100644 --- a/src/app/stats/utils/fetchGovernanceMetrics.ts +++ b/src/app/stats/utils/fetchGovernanceMetrics.ts @@ -73,8 +73,13 @@ const DEV_STATS: PositionMetricsByGroup = { }, }, } + +// HEROKU_PR_NUMBER injected to env vars when review app. +const SHOW_DEV_STATS = + process.env.NODE_ENV === "development" || !!process.env.HEROKU_PR_NUMBER + const getHntGovernanceMetrics = async () => { - if (process.env.NODE_ENV === "development") { + if (SHOW_DEV_STATS) { return DEV_STATS } @@ -93,7 +98,7 @@ const getHntGovernanceMetrics = async () => { export const fetchHntGovernanceStats = cache(getHntGovernanceMetrics) const getSubDaoGovernanceMetrics = async (subDao: SubDao) => { - if (process.env.NODE_ENV === "development") { + if (SHOW_DEV_STATS) { return DEV_STATS[subDao] }