fix no markets specified behavior

This commit is contained in:
wphan
2023-12-26 10:21:16 -08:00
parent 53ddc42540
commit 137f934341

View File

@@ -103,16 +103,20 @@ const getMarketsAndOraclesToLoad = (
const noMarketsSpecified = !PERP_MARKETS_TO_LOAD && !SPOT_MARKETS_TO_LOAD; const noMarketsSpecified = !PERP_MARKETS_TO_LOAD && !SPOT_MARKETS_TO_LOAD;
let perpIndexes = PERP_MARKETS_TO_LOAD; let perpIndexes = PERP_MARKETS_TO_LOAD;
if (!perpIndexes && noMarketsSpecified) { if (!perpIndexes) {
perpIndexes = sdkConfig.PERP_MARKETS.map((m) => m.marketIndex); if (noMarketsSpecified) {
} else { perpIndexes = sdkConfig.PERP_MARKETS.map((m) => m.marketIndex);
perpIndexes = []; } else {
perpIndexes = [];
}
} }
let spotIndexes = SPOT_MARKETS_TO_LOAD; let spotIndexes = SPOT_MARKETS_TO_LOAD;
if (!spotIndexes && noMarketsSpecified) { if (!spotIndexes) {
spotIndexes = sdkConfig.SPOT_MARKETS.map((m) => m.marketIndex); if (noMarketsSpecified) {
} else { spotIndexes = sdkConfig.SPOT_MARKETS.map((m) => m.marketIndex);
spotIndexes = []; } else {
spotIndexes = [];
}
} }
if (perpIndexes.length > 0) { if (perpIndexes.length > 0) {