Skip to content

Commit cb2b795

Browse files
authored
Merge pull request #2411 from pyth-network/cprussin/ui-68-fix-no-feed-exists-named-cryptoionusd-on-many-price-feed
fix(insights): don't blow up on invalid featured symbol
2 parents ea112e6 + b9f17e7 commit cb2b795

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

apps/insights/src/components/PriceFeeds/index.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,9 @@ const filterFeeds = <T extends { symbol: string }>(
210210
feeds: T[],
211211
symbols: string[],
212212
): T[] =>
213-
symbols.map((symbol) => {
214-
const feed = feeds.find((feed) => feed.symbol === symbol);
215-
if (feed) {
216-
return feed;
217-
} else {
218-
throw new NoSuchFeedError(symbol);
219-
}
220-
});
213+
symbols
214+
.map((symbol) => feeds.find((feed) => feed.symbol === symbol))
215+
.filter((feed) => feed !== undefined);
221216

222217
const isActive = (feed: { price: { minPublishers: number } }) =>
223218
feed.price.minPublishers <= 50;
224-
225-
class NoSuchFeedError extends Error {
226-
constructor(symbol: string) {
227-
super(`No feed exists named ${symbol}`);
228-
this.name = "NoSuchFeedError";
229-
}
230-
}

apps/insights/src/static-data/price-feeds.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export const priceFeeds = {
77
"Commodities.WTI1M",
88
"Crypto.1INCH/USD",
99
],
10-
featuredComingSoon: ["Crypto.ION/USD", "Equity.NL.BCOIN/USD"],
10+
featuredComingSoon: ["Rates.US1Y"],
1111
};

0 commit comments

Comments
 (0)