mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-20 14:05:27 +01:00
FIX: Place caching mechanism in a try catch
This commit is contained in:
parent
5a0c72a55a
commit
697cb0f198
1 changed files with 12 additions and 11 deletions
|
@ -129,19 +129,20 @@ export default class SendDetails extends Component {
|
|||
async componentDidMount() {
|
||||
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
|
||||
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
|
||||
try {
|
||||
const cachedNetworkTransactionFees = JSON.parse(await AsyncStorage.getItem(NetworkTransactionFee.StorageKey));
|
||||
|
||||
const cachedNetworkTransactionFees = JSON.parse(await AsyncStorage.getItem(NetworkTransactionFee.StorageKey));
|
||||
if (cachedNetworkTransactionFees.halfHourFee) {
|
||||
this.setState({
|
||||
fee: cachedNetworkTransactionFees.halfHourFee,
|
||||
networkTransactionFees: cachedNetworkTransactionFees,
|
||||
feeSliderValue: cachedNetworkTransactionFees.halfHourFee,
|
||||
});
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
if (cachedNetworkTransactionFees.halfHourFee) {
|
||||
this.setState({
|
||||
fee: cachedNetworkTransactionFees.halfHourFee,
|
||||
networkTransactionFees: cachedNetworkTransactionFees,
|
||||
feeSliderValue: cachedNetworkTransactionFees.halfHourFee,
|
||||
});
|
||||
}
|
||||
|
||||
const recommendedFees = await NetworkTransactionFees.recommendedFees();
|
||||
if (recommendedFees.hasOwnProperty('halfHourFee')) {
|
||||
let recommendedFees = await NetworkTransactionFees.recommendedFees();
|
||||
if (recommendedFees.halfHourFee) {
|
||||
await AsyncStorage.setItem(NetworkTransactionFee.StorageKey, JSON.stringify(recommendedFees));
|
||||
this.setState({
|
||||
fee: recommendedFees.halfHourFee,
|
||||
|
|
Loading…
Add table
Reference in a new issue