From 350a3441ccfda20557775fbfb5115a1288c0d0e1 Mon Sep 17 00:00:00 2001 From: Juanma Hidalgo Date: Mon, 9 Dec 2024 14:52:14 +0100 Subject: [PATCH] fix: add waitForFeatureFlagsToBeLoaded to analytics sagas --- webapp/src/modules/analytics/sagas.ts | 3 +++ webapp/src/modules/vendor/decentraland/catalog/api.ts | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/webapp/src/modules/analytics/sagas.ts b/webapp/src/modules/analytics/sagas.ts index f41dafe292..3d5c4e5ce2 100644 --- a/webapp/src/modules/analytics/sagas.ts +++ b/webapp/src/modules/analytics/sagas.ts @@ -3,6 +3,7 @@ import { t } from 'decentraland-dapps/dist/modules/translation/utils' import { config } from '../../config' import { isErrorWithMessage } from '../../lib/error' import { getIsOffchainPublicItemOrdersEnabled } from '../features/selectors' +import { waitForFeatureFlagsToBeLoaded } from '../features/utils' import { AnalyticsService } from '../vendor/decentraland' import { RankingsAPI } from '../vendor/decentraland/rankings/api' import { @@ -29,6 +30,7 @@ export function* handleFetchVolumeDataRequest(action: FetchAnalyticsDayDataReque const { timeframe } = action.payload try { + yield call(waitForFeatureFlagsToBeLoaded) const isOffChainOrderEnabled = (yield select(getIsOffchainPublicItemOrdersEnabled)) as ReturnType< typeof getIsOffchainPublicItemOrdersEnabled > @@ -45,6 +47,7 @@ export function* handleFetchVolumeDataRequest(action: FetchAnalyticsDayDataReque function* handleFetchRankingsRequest(action: FetchRankingsRequestAction) { const { entity, filters, timeframe } = action.payload try { + yield call(waitForFeatureFlagsToBeLoaded) const isOffChainOrderEnabled = (yield select(getIsOffchainPublicItemOrdersEnabled)) as ReturnType< typeof getIsOffchainPublicItemOrdersEnabled > diff --git a/webapp/src/modules/vendor/decentraland/catalog/api.ts b/webapp/src/modules/vendor/decentraland/catalog/api.ts index c95012be67..97f85d1aab 100644 --- a/webapp/src/modules/vendor/decentraland/catalog/api.ts +++ b/webapp/src/modules/vendor/decentraland/catalog/api.ts @@ -1,5 +1,6 @@ import { Item, CatalogFilters } from '@dcl/schemas' import { BaseClient } from 'decentraland-dapps/dist/lib/BaseClient' +import { config } from '../../../../config' import { MARKETPLACE_SERVER_URL } from '../marketplace/api' import { retryParams } from '../utils' @@ -7,7 +8,8 @@ export class CatalogAPI extends BaseClient { async get(filters: CatalogFilters = {}, options?: { v2?: boolean; headers?: Record }): Promise<{ data: Item[] }> { const queryParams = this.buildItemsQueryString(filters) const { headers, v2 = false } = options || {} - const isUsingMarketplaceAPI = this.baseUrl.includes('marketplace-api') + const marketplaceAPIURL = config.get('MARKETPLACE_SERVER_URL') + const isUsingMarketplaceAPI = this.baseUrl.includes(marketplaceAPIURL) // the V2 endpoint is only available in the marketplace API return this.fetch(`/${v2 && isUsingMarketplaceAPI ? 'v2' : 'v1'}/catalog?${queryParams}`, { headers