Skip to content

Commit

Permalink
Added temporal patch to avoid dispatching old state to Redux store.
Browse files Browse the repository at this point in the history
  • Loading branch information
Freshenext committed Sep 28, 2023
1 parent 8966026 commit 6bbba4c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/subscriptions/onSocketChangeEmitted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { UsdPricesState, setUsdPrices } from 'store/slices/usdPricesSlice'
import { AppDispatch } from 'store/index'
import { ChainTypesByIdType } from 'shared/constants/chainConstants'
import { getCurrentChainId } from 'storage/ChainStorage'

import { AbiWallet, Action } from './types'

Expand Down Expand Up @@ -74,6 +75,12 @@ export const onSocketChangeEmitted =
chainId,
}: OnSocketChangeEmittedArgs) =>
(action: Action) => {
// Temporal patch to avoid dispatching events if current chainId does not match
// @TODO find root cause of why the rifSockets is emitting an outdated event
// Suspect is the .disconnect is not playing its part
if (chainId !== getCurrentChainId()) {
return
}
if (action.type === 'reset') {
dispatch(resetSocketState())
} else {
Expand Down

0 comments on commit 6bbba4c

Please sign in to comment.