diff --git a/packages/neuron-ui/src/components/NetworkStatus/index.tsx b/packages/neuron-ui/src/components/NetworkStatus/index.tsx index 5fde398cf4..2a3c9b575e 100644 --- a/packages/neuron-ui/src/components/NetworkStatus/index.tsx +++ b/packages/neuron-ui/src/components/NetworkStatus/index.tsx @@ -57,7 +57,7 @@ const NetworkStatus = ({ ) : null} {isMigrate &&
{t('network-status.migrating')}
} {network ? ( -
+
{network.name}
diff --git a/packages/neuron-ui/src/components/NetworkStatus/networkStatus.module.scss b/packages/neuron-ui/src/components/NetworkStatus/networkStatus.module.scss index 562b4ec785..95fd700a2b 100644 --- a/packages/neuron-ui/src/components/NetworkStatus/networkStatus.module.scss +++ b/packages/neuron-ui/src/components/NetworkStatus/networkStatus.module.scss @@ -9,13 +9,17 @@ $hover-bg-color: #3cc68a4d; font-size: 0.8rem; font-weight: bold; - .name { - position: relative; - display: flex; - align-items: center; - line-height: 1em; - word-break: break-all; - margin-top: 3px; + .networkDisplay { + max-width: 100%; + + .name { + position: relative; + display: block; + line-height: 16px; + word-break: break-all; + overflow-wrap: break-word; + margin-top: 3px; + } } /* keep the tooltip popped to make it more obvious */ diff --git a/packages/neuron-wallet/src/database/chain/index.ts b/packages/neuron-wallet/src/database/chain/index.ts index e01503f5ff..94a266ed6a 100644 --- a/packages/neuron-wallet/src/database/chain/index.ts +++ b/packages/neuron-wallet/src/database/chain/index.ts @@ -7,18 +7,19 @@ import TransactionEntity from './entities/transaction' import SyncInfoEntity from './entities/sync-info' import IndexerTxHashCache from './entities/indexer-tx-hash-cache' import MultisigOutput from './entities/multisig-output' +import SyncProgress from './entities/sync-progress' /* * Clean local sqlite storage */ -export const clean = async () => { +export const clean = async (clearAllLightClientData?: boolean) => { await Promise.all([ ...[InputEntity, OutputEntity, TransactionEntity, IndexerTxHashCache, MultisigOutput].map(entity => { return getConnection() .getRepository(entity) .clear() }), - SyncProgressService.clearCurrentWalletProgress() + clearAllLightClientData ? getConnection().getRepository(SyncProgress).clear() : SyncProgressService.clearCurrentWalletProgress() ]) MultisigOutputChangedSubject.getSubject().next('reset') diff --git a/packages/neuron-wallet/src/services/light-runner.ts b/packages/neuron-wallet/src/services/light-runner.ts index e2f495adca..2db887e093 100644 --- a/packages/neuron-wallet/src/services/light-runner.ts +++ b/packages/neuron-wallet/src/services/light-runner.ts @@ -166,7 +166,7 @@ export class CKBLightRunner extends NodeRunner { async clearNodeCache(): Promise { await this.stop() fs.rmSync(SettingsService.getInstance().testnetLightDataPath, { recursive: true, force: true }) - await clean() + await clean(true) await this.start() resetSyncTaskQueue.asyncPush(true) } diff --git a/packages/neuron-wallet/src/services/sync-progress.ts b/packages/neuron-wallet/src/services/sync-progress.ts index 7a1d9d5a9b..0a856973a4 100644 --- a/packages/neuron-wallet/src/services/sync-progress.ts +++ b/packages/neuron-wallet/src/services/sync-progress.ts @@ -1,4 +1,4 @@ -import { getConnection, In, Not } from 'typeorm' +import { Equal, getConnection, In, Not } from 'typeorm' import { scriptToHash } from '@nervosnetwork/ckb-sdk-utils' import { HexString } from '@ckb-lumos/base' import SyncProgress, { SyncAddressType } from '../database/chain/entities/sync-progress' @@ -129,5 +129,11 @@ export default class SyncProgressService { await getConnection() .getRepository(SyncProgress) .delete({ walletId: currentWallet?.id }) + await getConnection() + .createQueryBuilder() + .update(SyncProgress) + .set({ blockEndNumber: 0, cursor: undefined }) + .where({ walletId: Not(Equal(currentWallet?.id)) }) + .execute() } }