Skip to content

Commit

Permalink
Merge pull request #626 from alexstotsky/fix-wrong-symbols
Browse files Browse the repository at this point in the history
(fix) Wrong symbol param for getPublicTrades request
  • Loading branch information
prdn authored Mar 31, 2023
2 parents 47879bb + 836adfd commit b6e6611
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/state/publicTrades/saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from 'redux-saga/effects'

import { makeFetchCall } from 'state/utils'
import { formatRawSymbols, mapRequestPairs } from 'state/symbols/utils'
import { formatRawSymbols, deformatPair } from 'state/symbols/utils'
import { getTimeFrame } from 'state/timeRange/selectors'
import { getFilterQuery } from 'state/filters/selectors'
import { refreshPagination, updatePagination } from 'state/pagination/actions'
Expand All @@ -33,8 +33,9 @@ function getReqPublicTrades({
end,
filter,
limit: getQueryLimit(TYPE),
symbol: formatRawSymbols(mapRequestPairs(targetPair, true)),
symbol: formatRawSymbols(deformatPair(targetPair)),
}

return makeFetchCall('getPublicTrades', params)
}

Expand Down
4 changes: 3 additions & 1 deletion src/state/symbols/reducer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _map from 'lodash/map'

import authTypes from 'state/auth/constants'
import { formatPair, mapPair, mapSymbol } from 'state/symbols/utils'

Expand Down Expand Up @@ -67,8 +69,8 @@ export function symbolsReducer(state = initialState, action) {
SymbolMap.setSymbols(symbolMapping)
SymbolMap.setPairs(pairMapping)

const formattedPairs = _map(pairs, formatPair).sort()
const formattedInactiveCurrencies = inactiveCurrencies.map(mapSymbol).sort()
const formattedPairs = pairs.map(formatPair).map(mapPair).sort()
const formattedInactivePairs = inactiveSymbols.map(formatPair).map(mapPair).sort()

return {
Expand Down
6 changes: 4 additions & 2 deletions src/state/symbols/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export * from './mapping'
// BTCUSD -> tBTCUSD
// BTCF0:USDF0 -> tBTCF0:USDF0
// USD -> fUSD
const addPrefix = (symbol = '', isFunding = false) => (
export const addPrefix = (symbol = '', isFunding = false) => (
(isFunding || symbol.length < 6) ? `f${symbol}` : `t${symbol}`
)

Expand Down Expand Up @@ -61,7 +61,7 @@ export const getSymbolsURL = (symbols) => {

// BTC:USD -> BTCUSD
// BTCF0:USTF0 -> BTCF0:USTF0
const deformatPair = pair => ((pair.length === 7) ? pair.replace(':', '') : pair)
export const deformatPair = pair => ((pair.length === 7) ? pair.replace(':', '') : pair)

// BTCUSD -> tBTCUSD
// ['BTCUSD'] -> 'tBTCUSD'
Expand All @@ -80,7 +80,9 @@ export const formatRawSymbols = (symbols, isFunding) => {
}

export default {
addPrefix,
formatPair,
deformatPair,
formatRawSymbols,
getMappedSymbolsFromUrl,
getSymbolsURL,
Expand Down
4 changes: 2 additions & 2 deletions src/state/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const checkInit = (props, type) => {
if (!dataReceived && !pageLoading) {
const pair = (match.params && match.params.pair) || ''
if (pair) {
setTargetPair(getMappedSymbolsFromUrl(pair)[0])
setTargetPair(pair)
}
fetchData()
}
Expand Down Expand Up @@ -327,7 +327,7 @@ export function setPair(type, props, pair) {

if (targetPair !== pair) {
setTargetPair(pair)
history.push(generateUrl(type, window.location.search, demapPairs(pair)))
history.push(generateUrl(type, window.location.search, [pair]))
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/ui/Select/_Select.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.bitfinex-select {
.bp3-button {
width: 180px;
min-width: 180px;
width: fit-content;
height: 40px;
padding-right: 8px;
background-color: var(--multiBg);
Expand Down

0 comments on commit b6e6611

Please sign in to comment.