diff --git a/src/components/discovery/CampaignsDiscoverySection.tsx b/src/components/discovery/CampaignsDiscoverySection.tsx index 00c469e5..0c941d60 100644 --- a/src/components/discovery/CampaignsDiscoverySection.tsx +++ b/src/components/discovery/CampaignsDiscoverySection.tsx @@ -124,7 +124,11 @@ export function CampaignsDiscoverySection({ const { data: featuredCampaigns } = useCampaigns({ coordinates: featuredCoords, limit: featuredCoords.length || 1, - enabled: moderationReady, + // Mirrors the pledges section's pattern: don't enable the query + // when there are no coords to fetch. `useCampaigns` already + // short-circuits internally on an empty `coordinates` array, so + // this is purely about not creating a meaningless cache entry. + enabled: moderationReady && featuredCoords.length > 0, }); const showHiddenValue = showHiddenProp?.value ?? false; diff --git a/src/components/discovery/PledgesDiscoverySection.tsx b/src/components/discovery/PledgesDiscoverySection.tsx index 24cd6afd..f9b29b80 100644 --- a/src/components/discovery/PledgesDiscoverySection.tsx +++ b/src/components/discovery/PledgesDiscoverySection.tsx @@ -123,9 +123,18 @@ export function PledgesDiscoverySection({ }, }); + // Chronological feed that backs the idle grid (and the + // featured-then-chronological fallback). Gated on `!isSearching` + // because the search branch renders `searchHits` instead and never + // reads `rawActions` / `actions` — leaving this query enabled during + // search burns a 300-event relay round-trip on every keystroke that + // activates the search view. The idle branch is the only consumer, + // and the idle branch only renders when `!isSearching`, so this + // gate strictly removes wasted work. const { data: rawActions, isLoading: actionsLoading } = useActions({ countryCode: filters.country, limit: 300, + enabled: !isSearching, }); const { data: pledgeModeration, isReady: pledgeModerationReady } =