Clear trackedTokens so that a user starts tracking the new WETH and no longer the old one
This commit is contained in:
@@ -10,6 +10,7 @@ import {BrowserRouter as Router, Link, Redirect, Route, Switch} from 'react-rout
|
||||
import * as injectTapEventPlugin from 'react-tap-event-plugin';
|
||||
import {createStore, Store as ReduxStore} from 'redux';
|
||||
import {createLazyComponent} from 'ts/lazy_component';
|
||||
import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage';
|
||||
import {tradeHistoryStorage} from 'ts/local_storage/trade_history_storage';
|
||||
import {About} from 'ts/pages/about/about';
|
||||
import {FAQ} from 'ts/pages/faq/faq';
|
||||
@@ -29,6 +30,7 @@ BigNumber.config({
|
||||
|
||||
// Check if we've introduced an update that requires us to clear the tradeHistory local storage entries
|
||||
tradeHistoryStorage.clearIfRequired();
|
||||
trackedTokenStorage.clearIfRequired();
|
||||
|
||||
const CUSTOM_GREY = 'rgb(39, 39, 39)';
|
||||
const CUSTOM_GREEN = 'rgb(102, 222, 117)';
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
import * as _ from 'lodash';
|
||||
import {localStorage} from 'ts/local_storage/local_storage';
|
||||
import {Token, TrackedTokensByNetworkId} from 'ts/types';
|
||||
import {configs} from 'ts/utils/configs';
|
||||
|
||||
const TRACKED_TOKENS_KEY = 'trackedTokens';
|
||||
const TRACKED_TOKENS_CLEAR_KEY = 'lastClearTrackedTokensDate';
|
||||
|
||||
export const trackedTokenStorage = {
|
||||
// Clear trackedTokens localStorage if we've updated the config variable in an update
|
||||
// that introduced a backward incompatible change requiring the tracked tokens to be re-set
|
||||
clearIfRequired() {
|
||||
const lastClearFillDate = localStorage.getItemIfExists(TRACKED_TOKENS_CLEAR_KEY);
|
||||
if (lastClearFillDate !== configs.lastLocalStorageTrackedTokenClearanceDate) {
|
||||
localStorage.removeItem(TRACKED_TOKENS_KEY);
|
||||
}
|
||||
localStorage.setItem(TRACKED_TOKENS_CLEAR_KEY, configs.lastLocalStorageTrackedTokenClearanceDate);
|
||||
},
|
||||
addTrackedTokenToUser(userAddress: string, networkId: number, token: Token) {
|
||||
const trackedTokensByUserAddress = this.getTrackedTokensByUserAddress();
|
||||
let trackedTokensByNetworkId = trackedTokensByUserAddress[userAddress];
|
||||
|
||||
@@ -14,6 +14,7 @@ export const configs = {
|
||||
// WARNING: ZRX & WETH MUST always be default trackedTokens
|
||||
defaultTrackedTokenSymbols: ['WETH', 'ZRX'],
|
||||
lastLocalStorageFillClearanceDate: '2017-11-22',
|
||||
lastLocalStorageTrackedTokenClearanceDate: '2017-12-13',
|
||||
isMainnetEnabled: true,
|
||||
outdatedWrappedEthers: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user