Skip to content

Commit

Permalink
bug fixed: some pools' ids not match case
Browse files Browse the repository at this point in the history
  • Loading branch information
tncoskun committed Jan 15, 2025
1 parent 322e930 commit 966a6e6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
24 changes: 16 additions & 8 deletions src/contexts/CandleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ export const CandleContextProvider = (props: { children: React.ReactNode }) => {
setIsCondensedModeEnabled(true);
}

baseTokenAddressRef.current = baseTokenAddress;
quoteTokenAddressRef.current = quoteTokenAddress;
baseTokenAddressRef.current =
baseTokenAddress.toLocaleLowerCase('en-US');
quoteTokenAddressRef.current =
quoteTokenAddress.toLocaleLowerCase('en-US');
}, [poolTokenAddress, chainId]);

// only works when the period changes
Expand All @@ -220,8 +222,10 @@ export const CandleContextProvider = (props: { children: React.ReactNode }) => {
isUserOnline &&
(await crocEnv.context).chain.chainId === chainId &&
isChartEnabled &&
baseTokenAddressRef.current === baseTokenAddress &&
quoteTokenAddressRef.current === quoteTokenAddress &&
baseTokenAddressRef.current ===
baseTokenAddress.toLocaleLowerCase('en-US') &&
quoteTokenAddressRef.current ===
quoteTokenAddress.toLocaleLowerCase('en-US') &&
candleData === undefined
) {
fetchCandles();
Expand All @@ -237,8 +241,10 @@ export const CandleContextProvider = (props: { children: React.ReactNode }) => {
candleData === undefined,
crocEnv,
chainId,
baseTokenAddressRef.current === baseTokenAddress &&
quoteTokenAddressRef.current === quoteTokenAddress,
baseTokenAddressRef.current ===
baseTokenAddress.toLocaleLowerCase('en-US'),
quoteTokenAddressRef.current ===
quoteTokenAddress.toLocaleLowerCase('en-US'),
]);

useEffect(() => {
Expand Down Expand Up @@ -348,8 +354,10 @@ export const CandleContextProvider = (props: { children: React.ReactNode }) => {
)
.then((candles) => {
if (
baseTokenAddressRef.current === baseTokenAddress &&
quoteTokenAddressRef.current === quoteTokenAddress
baseTokenAddressRef.current ===
baseTokenAddress.toLocaleLowerCase('en-US') &&
quoteTokenAddressRef.current ===
quoteTokenAddress.toLocaleLowerCase('en-US')
) {
setCandleData(candles);
const candleSeries = candles?.candles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,10 @@ function TradeCandleStickChart(props: propsIF) {
prevPeriod === period &&
scaleData &&
period === candleData?.duration &&
candleData.pool.baseAddress === baseTokenAddress &&
candleData.pool.quoteAddress === quoteTokenAddress &&
candleData.pool.baseAddress.toLocaleLowerCase('en-US') ===
baseTokenAddress.toLocaleLowerCase('en-US') &&
candleData.pool.quoteAddress.toLocaleLowerCase('en-US') ===
quoteTokenAddress.toLocaleLowerCase('en-US') &&
!isFetchingCandle &&
!isFetchingEnoughData;

Expand Down

0 comments on commit 966a6e6

Please sign in to comment.