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

Commit

Permalink
Merge branch 'develop' into remove-locked-aspect-ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
qwhex committed Feb 2, 2021
2 parents 47ca99c + 3b8f97a commit 2eb8b74
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
steps:
- label: ":nix::point_right::pipeline:"
command: |
export NIX_PATH="nixpkgs=$(nix eval --raw '(import nix/sources.nix).nixpkgs')"
nix eval --json '(import ./.buildkite { pipeline = ./.buildkite/pipeline.nix; })' \
export NIX_PATH="nixpkgs=$(nix eval --impure --raw --expr '(import nix/sources.nix).nixpkgs')"
nix eval --impure --json --expr '(import ./.buildkite { pipeline = ./.buildkite/pipeline.nix; })' \
| buildkite-agent pipeline upload --no-interpolation
agents:
Expand Down
16 changes: 8 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import classnames from 'classnames'
import React, {useEffect} from 'react'
import _ from 'lodash/fp'
import {SplashScreen} from './SplashScreen'
import {
BackendState,
defaultBackendData,
migrationsForBackendData,
StoreBackendData,
} from './common/backend-state'
import {BackendState, defaultBackendData, StoreBackendData} from './common/backend-state'
import {rendererLog} from './common/logger'
import {createPersistentStore, Store} from './common/store'
import {WalletState, defaultWalletData, StoreWalletData} from './common/wallet-state'
import {
WalletState,
defaultWalletData,
StoreWalletData,
migrationsForWalletData,
} from './common/wallet-state'
import {config} from './config/renderer'
import {Router} from './layout/Router'
import {Sidebar} from './layout/Sidebar'
Expand Down Expand Up @@ -50,7 +50,7 @@ const mergeMigrations = _.mergeAllWith(
},
)

const migrations = mergeMigrations([migrationsForBackendData])
const migrations = mergeMigrations([migrationsForWalletData])
const store = createPersistentStore({defaults: defaultData, migrations})

const AppContent: React.FC = () => {
Expand Down
6 changes: 0 additions & 6 deletions src/common/backend-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,3 @@ function useBackendState(params?: Partial<BackendStateParams>): BackendState {
}

export const BackendState = createContainer(useBackendState)

export const migrationsForBackendData = {
'0.1.2-mantis-wallet': (store: Store<StoreBackendData>): void => {
store.set('networkName', config.networkName)
},
}
7 changes: 4 additions & 3 deletions src/common/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ export function createPersistentStore<T extends object>(
key: K1 | [K1, K2] | [K1, K2, K3],
value: T[K1] | T[K1][K2] | T[K1][K2][K3],
): void {
if (_.isArray(key)) {
store.set(key.join('.'), value)
const path = _.isArray(key) ? key.join('.') : key
if (value === undefined) {
store.delete(path)
} else {
store.set(key, value)
store.set(path, value)
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/common/wallet-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,4 +679,10 @@ function useWalletState(initialState?: Partial<WalletStateParams>): WalletData {
}
}

export const migrationsForWalletData = {
'0.1.0-mantis-wallet': (store: Store<StoreWalletData>): void => {
store.set(['wallet', 'txHistory'], {})
},
}

export const WalletState = createContainer(useWalletState)
2 changes: 1 addition & 1 deletion src/wallets/history/HistoryStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {StoreWalletData} from '../../common/wallet-state'
import {NetworkName} from '../../config/type'

export interface TxHistoryStoreData {
txHistory: Record<NetworkName, StoredHistory.StoredHistory | undefined>
txHistory: Record<NetworkName, StoredHistory.StoredHistory>
}
export const defaultTxHistoryStoreData: TxHistoryStoreData = {
txHistory: {},
Expand Down

0 comments on commit 2eb8b74

Please sign in to comment.