Skip to content

Commit

Permalink
fix: add waitForFeatureFlagsToBeLoaded to analytics sagas
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo committed Dec 9, 2024
1 parent 9809b6d commit 350a344
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions webapp/src/modules/analytics/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
>
Expand All @@ -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
>
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/modules/vendor/decentraland/catalog/api.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
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'

export class CatalogAPI extends BaseClient {
async get(filters: CatalogFilters = {}, options?: { v2?: boolean; headers?: Record<string, string> }): 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
Expand Down

0 comments on commit 350a344

Please sign in to comment.