Commit 94aa8ae2 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: avoid error swap state while loading (#5860)

fix: omit price impact warning while loading
parent 6cb0824a
...@@ -119,8 +119,8 @@ describe('prices', () => { ...@@ -119,8 +119,8 @@ describe('prices', () => {
}) })
describe('#warningSeverity', () => { describe('#warningSeverity', () => {
it('max for undefined', () => { it('0 for undefined', () => {
expect(warningSeverity(undefined)).toEqual(4) expect(warningSeverity(undefined)).toEqual(0)
}) })
it('correct for 0', () => { it('correct for 0', () => {
expect(warningSeverity(new Percent(0))).toEqual(0) expect(warningSeverity(new Percent(0))).toEqual(0)
......
...@@ -84,7 +84,7 @@ const IMPACT_TIERS = [ ...@@ -84,7 +84,7 @@ const IMPACT_TIERS = [
type WarningSeverity = 0 | 1 | 2 | 3 | 4 type WarningSeverity = 0 | 1 | 2 | 3 | 4
export function warningSeverity(priceImpact: Percent | undefined): WarningSeverity { export function warningSeverity(priceImpact: Percent | undefined): WarningSeverity {
if (!priceImpact) return 4 if (!priceImpact) return 0
let impact: WarningSeverity = IMPACT_TIERS.length as WarningSeverity let impact: WarningSeverity = IMPACT_TIERS.length as WarningSeverity
for (const impactLevel of IMPACT_TIERS) { for (const impactLevel of IMPACT_TIERS) {
if (impactLevel.lessThan(priceImpact)) return impact if (impactLevel.lessThan(priceImpact)) return impact
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment