|
16 | 16 | generateMigrationAddress, |
17 | 17 | hardwareIndexes, |
18 | 18 | hasMigratedAndConfirmedAllSelectedBundles, |
| 19 | + hasMigratedAndConfirmedSomeSelectedBundles, |
19 | 20 | hasMigratedAnyBundle, |
20 | 21 | migration, |
21 | 22 | migrationAddress, |
|
38 | 39 | let migrated = false |
39 | 40 | let migratingFundsMessage = '' |
40 | 41 | let fullSuccess = $hasMigratedAndConfirmedAllSelectedBundles |
| 42 | + let someSuccess = $hasMigratedAndConfirmedSomeSelectedBundles |
41 | 43 |
|
42 | 44 | const legacyLedger = $walletSetupType === SetupType.TrinityLedger |
43 | 45 | $: animation = legacyLedger ? 'ledger-migrate-desktop' : 'migrate-desktop' |
|
66 | 68 | busy = false |
67 | 69 | } |
68 | 70 |
|
69 | | - const unsubscribe = hasMigratedAndConfirmedAllSelectedBundles.subscribe( |
| 71 | + const hasMigratedAndConfirmedAllSelectedBundlesUnsubscribe = hasMigratedAndConfirmedAllSelectedBundles.subscribe( |
70 | 72 | (_hasMigratedAndConfirmedAllSelectedBundles) => { |
71 | 73 | fullSuccess = _hasMigratedAndConfirmedAllSelectedBundles |
72 | 74 |
|
|
79 | 81 | } |
80 | 82 | ) |
81 | 83 |
|
| 84 | + const hasMigratedAndConfirmedSomeSelectedBundlesUnsubscribe = hasMigratedAndConfirmedSomeSelectedBundles.subscribe( |
| 85 | + (_hasMigratedAndConfirmedSomeSelectedBundles) => { |
| 86 | + someSuccess = _hasMigratedAndConfirmedSomeSelectedBundles |
| 87 | + } |
| 88 | + ) |
| 89 | +
|
82 | 90 | let migratedAndUnconfirmedBundles = [] |
83 | 91 |
|
84 | | - // TODO: add missing unsubscribe to onDestroy |
85 | | - confirmedBundles.subscribe((newConfirmedBundles) => { |
| 92 | + const confirmedBundlesUnsubscribe = confirmedBundles.subscribe((newConfirmedBundles) => { |
86 | 93 | newConfirmedBundles.forEach((bundle) => { |
87 | 94 | if (bundle.confirmed) { |
88 | 95 | migratedAndUnconfirmedBundles = migratedAndUnconfirmedBundles.filter( |
|
173 | 180 | } |
174 | 181 | }) |
175 | 182 |
|
176 | | - onDestroy(unsubscribe) |
| 183 | + onDestroy(() => { |
| 184 | + hasMigratedAndConfirmedAllSelectedBundlesUnsubscribe() |
| 185 | + confirmedBundlesUnsubscribe() |
| 186 | + hasMigratedAndConfirmedSomeSelectedBundlesUnsubscribe() |
| 187 | + }) |
177 | 188 |
|
178 | 189 | function handleMigrateClick() { |
179 | 190 | if (legacyLedger) { |
|
319 | 330 | <Spinner {busy} message={migratingFundsMessage} classes="justify-center" /> |
320 | 331 | {/if} |
321 | 332 | </Button> |
| 333 | + {:else if someSuccess} |
| 334 | + <div class="flex flex-row justify-center items-center py-3 mt-2 w-full space-x-2"> |
| 335 | + <Button classes="w-1/2 {$popupState.active && 'opacity-20'}" onClick={() => handleRerunClick()}> |
| 336 | + {locale('views.transferFragmentedFunds.rerun')} |
| 337 | + </Button> |
| 338 | + <Button classes="w-1/2" onClick={() => handleContinueClick()}> |
| 339 | + {locale('actions.continue')} |
| 340 | + </Button> |
| 341 | + </div> |
322 | 342 | {:else if fullSuccess} |
323 | 343 | <Button classes="w-full py-3 mt-2" onClick={() => handleContinueClick()} |
324 | 344 | >{locale('actions.continue')}</Button |
|
0 commit comments