Skip to content

Commit

Permalink
Merge branch 'brian/upgrade-assets-controllers-43' into brian/upgrade…
Browse files Browse the repository at this point in the history
…-assets-controllers-44
  • Loading branch information
bergeron authored Nov 15, 2024
2 parents 8978d6d + 979a3af commit 33d683f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ui/pages/asset/useHistoricalPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export const useHistoricalPrices = ({
const [loading, setLoading] = useState<boolean>(chainSupported);
const [data, setData] = useState<HistoricalPrices>({});

if (chainSupported) {
useEffect(() => {
useEffect(() => {
if (chainSupported) {
setLoading(true);
fetchWithCache({
url: `https://price.api.cx.metamask.io/v1/chains/${chainId}/historical-prices/${address}?vsCurrency=${currency}&timePeriod=${timeRange}`,
Expand All @@ -59,7 +59,11 @@ export const useHistoricalPrices = ({
setData({ prices, edges });
setLoading(false);
});
}, [chainId, address, currency, timeRange]);
}
} else {
setData({});
setLoading(false);
}
}, [chainSupported, chainId, address, currency, timeRange]);

return { loading, data };
};

0 comments on commit 33d683f

Please sign in to comment.