Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Remove unsused state (#2361)
Browse files Browse the repository at this point in the history
* Remove unsused state

* Fix code style issues with Prettier

* Remove dataApi and routingAPI

Co-authored-by: Lint Action <[email protected]>
  • Loading branch information
anxolin and lint-action authored Feb 1, 2022
1 parent 8d4d2ad commit 4955acc
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions src/custom/components/ErrorBoundary/ErrorBoundaryMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ function getRelevantState(): null | keyof AppState {
switch (pieces[0]) {
case 'swap':
return 'swap'
case 'add':
if (pieces[1] === 'v2') return 'mint'
else return 'mintV3'
case 'remove':
if (pieces[1] === 'v2') return 'burn'
else return 'burnV3'
// case 'add':
// if (pieces[1] === 'v2') return 'mint'
// else return 'mintV3'
// case 'remove':
// if (pieces[1] === 'v2') return 'burn'
// else return 'burnV3'
}
return null
}
Expand Down
24 changes: 12 additions & 12 deletions src/custom/state/application/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useIsWindowVisible from 'hooks/useIsWindowVisible'
import { useActiveWeb3React } from 'hooks/web3'
import ms from 'ms.macro'
import { useCallback, useEffect, useRef, useState } from 'react'
import { api, CHAIN_TAG } from 'state/data/enhanced'
// import { api, CHAIN_TAG } from 'state/data/enhanced'
import { useAppDispatch, useAppSelector } from 'state/hooks'
import { supportedChainId } from 'utils/supportedChainId'
import { switchToNetwork } from 'utils/switchToNetwork'
Expand All @@ -17,18 +17,18 @@ import {
updateChainId,
} from 'state/application/reducer'

function useQueryCacheInvalidator() {
const dispatch = useAppDispatch()
// function useQueryCacheInvalidator() {
// const dispatch = useAppDispatch()

// subscribe to `chainId` changes in the redux store rather than Web3
// this will ensure that when `invalidateTags` is called, the latest
// `chainId` is available in redux to build the subgraph url
const chainId = useAppSelector((state) => state.application.chainId)
// // subscribe to `chainId` changes in the redux store rather than Web3
// // this will ensure that when `invalidateTags` is called, the latest
// // `chainId` is available in redux to build the subgraph url
// const chainId = useAppSelector((state) => state.application.chainId)

useEffect(() => {
dispatch(api.util.invalidateTags([CHAIN_TAG]))
}, [chainId, dispatch])
}
// useEffect(() => {
// dispatch(api.util.invalidateTags([CHAIN_TAG]))
// }, [chainId, dispatch])
// }

const NETWORK_HEALTH_CHECK_MS = ms`15s`
const DEFAULT_MS_BEFORE_WARNING = ms`10m`
Expand Down Expand Up @@ -78,7 +78,7 @@ export default function Updater(): null {
})

useBlockWarningTimer()
useQueryCacheInvalidator()
// useQueryCacheInvalidator()

const blockNumberCallback = useCallback(
(blockNumber: number) => {
Expand Down
28 changes: 14 additions & 14 deletions src/custom/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import application from 'state/application/reducer'
// import { updateVersion } from '@src/state/global/actions'
import user from '@src/state/user/reducer'
import swap from '@src/state/swap/reducer'
import mint from '@src/state/mint/reducer'
import mintV3 from '@src/state/mint/v3/reducer'
// import mint from '@src/state/mint/reducer'
// import mintV3 from '@src/state/mint/v3/reducer'
// import lists from '@src/state/lists/reducer'
import burn from '@src/state/burn/reducer'
import burnV3 from '@src/state/burn/v3/reducer'
// import burn from '@src/state/burn/reducer'
// import burnV3 from '@src/state/burn/v3/reducer'
import logs from '@src/state/logs/slice'
import multicall from '@src/state/multicall/reducer'
import { api as dataApi } from '@src/state/data/slice'
import { routingApi } from '@src/state/routing/slice'
// import { api as dataApi } from '@src/state/data/slice'
// import { routingApi } from '@src/state/routing/slice'
// CUSTOM REDUCERS
import lists from 'state/lists/reducer'
import orders from 'state/orders/reducer'
Expand All @@ -33,15 +33,15 @@ const UNISWAP_REDUCERS = {
application,
user,
swap,
mint,
mintV3,
burn,
burnV3,
// mint,
// mintV3,
// burn,
// burnV3,
multicall,
// lists,
logs,
[dataApi.reducerPath]: dataApi.reducer,
[routingApi.reducerPath]: routingApi.reducer,
// [dataApi.reducerPath]: dataApi.reducer,
// [routingApi.reducerPath]: routingApi.reducer,
}

const reducers = {
Expand All @@ -62,8 +62,8 @@ const store = configureStore({
reducer: reducers,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({ thunk: true, serializableCheck: false })
.concat(dataApi.middleware)
.concat(routingApi.middleware)
// .concat(dataApi.middleware)
// .concat(routingApi.middleware)
.concat(save({ states: PERSISTED_KEYS, debounce: 1000 }))
.concat(popupMiddleware)
.concat(claimMinedMiddleware)
Expand Down
2 changes: 1 addition & 1 deletion src/state/burn/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk'
import JSBI from 'jsbi'
import { ReactNode, useCallback } from 'react'
import { useAppDispatch, useAppSelector } from 'state/hooks'
import { useAppDispatch, useAppSelector } from '@src/state/hooks'

import { useTotalSupply } from '../../hooks/useTotalSupply'
import { useV2Pair } from '../../hooks/useV2Pairs'
Expand Down
2 changes: 1 addition & 1 deletion src/state/burn/v3/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PositionDetails } from 'types/position'
import { AppState } from '../../index'
import { selectPercent } from './actions'
import { unwrappedToken } from 'utils/unwrappedToken'
import { useAppDispatch, useAppSelector } from 'state/hooks'
import { useAppDispatch, useAppSelector } from '@src/state/hooks'
// eslint-disable-next-line no-restricted-imports
import { t } from '@lingui/macro'

Expand Down
2 changes: 1 addition & 1 deletion src/state/burn/v3/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { usePool } from 'hooks/usePools'
import { useV3PositionFees } from 'hooks/useV3PositionFees'
import { useActiveWeb3React } from 'hooks/web3'
import { ReactNode, useCallback, useMemo } from 'react'
import { useAppDispatch, useAppSelector } from 'state/hooks'
import { useAppDispatch, useAppSelector } from '@src/state/hooks'
import { PositionDetails } from 'types/position'
import { unwrappedToken } from 'utils/unwrappedToken'

Expand Down
2 changes: 1 addition & 1 deletion src/state/mint/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Currency, CurrencyAmount, Percent, Price, Token } from '@uniswap/sdk-co
import { Pair } from '@uniswap/v2-sdk'
import JSBI from 'jsbi'
import { ReactNode, useCallback, useMemo } from 'react'
import { useAppDispatch, useAppSelector } from 'state/hooks'
import { useAppDispatch, useAppSelector } from '@src/state/hooks'

import { useTotalSupply } from '../../hooks/useTotalSupply'
import { PairState, useV2Pair } from '../../hooks/useV2Pairs'
Expand Down
2 changes: 1 addition & 1 deletion src/state/mint/v3/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from './actions'
import { tryParseTick } from './utils'
import { usePool } from 'hooks/usePools'
import { useAppDispatch, useAppSelector } from 'state/hooks'
import { useAppDispatch, useAppSelector } from '@src/state/hooks'

export function useV3MintState(): AppState['mintV3'] {
return useAppSelector((state) => state.mintV3)
Expand Down

0 comments on commit 4955acc

Please sign in to comment.