Fix marketDetails stringKey, do not update state with markets not tracked by Abacus (#61)
This commit is contained in:
parent
fa621a085b
commit
62eeab06f5
@ -35,6 +35,7 @@ import { setAssets } from '@/state/assets';
|
||||
import { setConfigs } from '@/state/configs';
|
||||
import { setInputs } from '@/state/inputs';
|
||||
import { setHistoricalFundings, setLiveTrades, setMarkets, setOrderbook } from '@/state/perpetuals';
|
||||
import { isTruthy } from '../isTruthy';
|
||||
|
||||
class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
||||
private store: RootStore | undefined;
|
||||
@ -84,7 +85,7 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
||||
dispatch(setBalances(balances));
|
||||
}
|
||||
if (updatedState.account?.stakingBalances) {
|
||||
const stakingBalances: Record<string, AccountBalance> = {}
|
||||
const stakingBalances: Record<string, AccountBalance> = {};
|
||||
for (const { k, v } of updatedState.account.stakingBalances.toArray()) {
|
||||
stakingBalances[k] = v;
|
||||
}
|
||||
@ -108,10 +109,12 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
||||
dispatch(
|
||||
setMarkets({
|
||||
markets: Object.fromEntries(
|
||||
(marketIds || updatedState.marketIds()?.toArray() || []).map((marketId: string) => {
|
||||
const marketData = updatedState.market(marketId);
|
||||
return [marketId, marketData];
|
||||
})
|
||||
(marketIds || updatedState.marketIds()?.toArray() || [])
|
||||
.map((marketId: string) => {
|
||||
const marketData = updatedState.market(marketId);
|
||||
return [marketId, marketData];
|
||||
})
|
||||
.filter(isTruthy)
|
||||
) as Record<string, PerpetualMarket>,
|
||||
update: !!marketIds,
|
||||
})
|
||||
|
||||
@ -139,11 +139,9 @@ export const MarketDetails: React.FC = () => {
|
||||
</Styled.WrapRow>
|
||||
|
||||
<Styled.MarketDescription>
|
||||
{primaryDescriptionKey && (
|
||||
<p>{stringGetter({ key: STRING_KEYS[primaryDescriptionKey as StringKey] })}</p>
|
||||
)}
|
||||
{primaryDescriptionKey && <p>{stringGetter({ key: `APP.${primaryDescriptionKey}` })}</p>}
|
||||
{secondaryDescriptionKey && (
|
||||
<p>{stringGetter({ key: STRING_KEYS[secondaryDescriptionKey as StringKey] })}</p>
|
||||
<p>{stringGetter({ key: `APP.${secondaryDescriptionKey}` })}</p>
|
||||
)}
|
||||
</Styled.MarketDescription>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user