diff --git a/webapp/src/modules/item/sagas.spec.ts b/webapp/src/modules/item/sagas.spec.ts index da8b13c7e..7ac034885 100644 --- a/webapp/src/modules/item/sagas.spec.ts +++ b/webapp/src/modules/item/sagas.spec.ts @@ -673,6 +673,7 @@ describe('when handling the fetch trending items request action', () => { it('should dispatch a successful action with the fetched trending items', () => { return expectSaga(itemSaga, getIdentity) .provide([ + [matchers.call.fn(waitForFeatureFlagsToBeLoaded), undefined], [select(getIsMarketplaceServerEnabled), true], [select(getIsOffchainPublicNFTOrdersEnabled), false], [matchers.call.fn(ItemAPI.prototype.getTrendings), fetchResult], @@ -691,7 +692,8 @@ describe('when handling the fetch trending items request action', () => { it('should dispatch a successful action with the fetched trending items', () => { return expectSaga(itemSaga, getIdentity) .provide([ - // [select(getIsMarketplaceServerEnabled), true], + [select(getIsMarketplaceServerEnabled), true], + [matchers.call.fn(waitForFeatureFlagsToBeLoaded), undefined], [matchers.call.fn(ItemAPI.prototype.getTrendings), fetchResult], [matchers.call.fn(waitForWalletConnectionAndIdentityIfConnecting), undefined] ]) @@ -706,6 +708,8 @@ describe('when handling the fetch trending items request action', () => { it('should dispatch a failing action with the error and the options', () => { return expectSaga(itemSaga, getIdentity) .provide([ + [select(getIsMarketplaceServerEnabled), true], + [matchers.call.fn(waitForFeatureFlagsToBeLoaded), undefined], [matchers.call.fn(ItemAPI.prototype.getTrendings), Promise.reject(anError)], [matchers.call.fn(waitForWalletConnectionAndIdentityIfConnecting), undefined] ]) diff --git a/webapp/src/modules/item/sagas.ts b/webapp/src/modules/item/sagas.ts index 0c06152f3..370b2bed6 100644 --- a/webapp/src/modules/item/sagas.ts +++ b/webapp/src/modules/item/sagas.ts @@ -123,8 +123,10 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { // If the wallet is getting connected, wait until it finishes to fetch the items so it can fetch them with authentication try { + yield call(waitForFeatureFlagsToBeLoaded) + const isMarketplaceServerEnabled: boolean = yield select(getIsMarketplaceServerEnabled) yield call(waitForWalletConnectionAndIdentityIfConnecting) - const { data }: { data: Item[] } = yield call([itemAPI, 'getTrendings'], size) + const { data }: { data: Item[] } = yield call([isMarketplaceServerEnabled ? marketplaceItemAPI : itemAPI, 'getTrendings'], size) if (!data.length) { yield put(fetchTrendingItemsSuccess([])) @@ -132,7 +134,6 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { } const ids = data.map(item => item.id) - const isMarketplaceServerEnabled: boolean = yield select(getIsMarketplaceServerEnabled) const api = isMarketplaceServerEnabled ? marketplaceServerCatalogAPI : catalogAPI const isOffchainEnabled: boolean = yield select(getIsOffchainPublicNFTOrdersEnabled) const { data: itemData }: { data: Item[]; total: number } = yield call(