From 50915f8c52893c9abff559a0eb008cc24cd2093e Mon Sep 17 00:00:00 2001 From: Dorian Date: Sat, 14 Feb 2026 16:29:56 +0000 Subject: [PATCH] fix: improve mock data handling in IndeehubApiService - Updated the getZapStats method to merge mock zap data when the API returns empty results or in development mode. - Introduced a new environment variable, VITE_HIDE_MOCK_ZAPS, to control the visibility of mock zaps in production. These changes ensure that the zap UI remains functional during development and improves the handling of scenarios with no available zap data. --- src/services/indeehub-api.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/services/indeehub-api.service.ts b/src/services/indeehub-api.service.ts index 0815b06..931c2d6 100644 --- a/src/services/indeehub-api.service.ts +++ b/src/services/indeehub-api.service.ts @@ -206,7 +206,8 @@ class IndeehubApiService { /** * Get zap stats for film cards (count, amount, recent zapper pubkeys) by project id. - * In dev, merges mock zap data for the first few projects so the UI is visible without real zaps. + * In dev, or when API returns empty (e.g. no zaps in DB yet), merges mock data so the zap UI is visible. + * Set VITE_HIDE_MOCK_ZAPS=true to never show mock zaps in production. */ async getZapStats(projectIds: string[]): Promise> { if (projectIds.length === 0) return {} @@ -221,7 +222,9 @@ class IndeehubApiService { } catch { data = {} } - if (import.meta.env.DEV) { + const hideMock = import.meta.env.VITE_HIDE_MOCK_ZAPS === 'true' + const shouldMock = !hideMock && (import.meta.env.DEV || Object.keys(data).length === 0) + if (shouldMock) { Object.assign(data, this.getMockZapStats(projectIds)) } return data