Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DDW-591] Fix delay on loading stake pool list after switching SMASH server #2447

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Changelog
- Enabled the "Loading Stake Pools" state anytime the pools are loading ([PR 2424](https://github.com/input-output-hk/daedalus/pull/2424))
- Implemented the syncing state for the Stake Pools settings screen ([PR 2418](https://github.com/input-output-hk/daedalus/pull/2418))

### Fixes

- Fixed delay on loading stake pool list after switching the SMASH server ([PR 2447](https://github.com/input-output-hk/daedalus/pull/2447))

### Chores

- Added configuration variable for native tokens formatted amounts display ([PR 2449](https://github.com/input-output-hk/daedalus/pull/2449))
Expand Down
2 changes: 1 addition & 1 deletion source/main/utils/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const logToLevel = (level: string) => (message: string, data: ?Object) =>

export const logger: Logger = {
debug: logToLevel('debug'),
info: logToLevel('info'),
info: () => {},
error: logToLevel('error'),
warn: logToLevel('warn'),
};
2 changes: 2 additions & 0 deletions source/renderer/app/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,7 @@ export default class AdaApi {
parameters: { stake },
});
try {
console.log('FETCHING');
const response: AdaApiStakePools = await getStakePools(
this.config,
stake
Expand All @@ -2151,6 +2152,7 @@ export default class AdaApi {
stakePoolsWithMetadata: stakePools.length,
unfilteredStakePools: response,
});
console.log('API RESULT', stakePools.length);
return stakePools;
} catch (error) {
logger.error('AdaApi::getStakePools error', { error });
Expand Down
7 changes: 7 additions & 0 deletions source/renderer/app/stores/StakingStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ export default class StakingStore extends Store {
// Retrieves the API update
this.smashServerLoading = true;
await this.updateSmashSettingsRequest.execute(smashServerUrl);
// Resets the Stake Pools list request
this.stakePoolsRequest.reset();
thedanheller marked this conversation as resolved.
Show resolved Hide resolved
// Refreshes the Stake Pools list
this.getStakePoolsData();
// Starts the SPs fetch tracker
Expand Down Expand Up @@ -460,6 +462,11 @@ export default class StakingStore extends Store {
}

@computed get stakePools(): Array<StakePool> {
console.log(
'STORE RESULT',
this.stakePoolsRequest.result ? this.stakePoolsRequest.result.length : '-'
);

return this.stakePoolsRequest.result ? this.stakePoolsRequest.result : [];
}

Expand Down
2 changes: 1 addition & 1 deletion source/renderer/app/utils/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const logToLevel = (level: LoggingLevel) => (

export const logger: Logger = {
debug: logToLevel('debug'),
info: logToLevel('info'),
info: () => {},
error: logToLevel('error'),
warn: logToLevel('warn'),
};