FIX: Place caching mechanism in a try catch

This commit is contained in:
Marcos Rodriguez Vélez 2019-02-01 01:58:12 -05:00
parent 5a0c72a55a
commit 697cb0f198

View file

@ -129,7 +129,7 @@ export default class SendDetails extends Component {
async componentDidMount() { async componentDidMount() {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow); this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide); 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) { if (cachedNetworkTransactionFees.halfHourFee) {
@ -139,9 +139,10 @@ export default class SendDetails extends Component {
feeSliderValue: cachedNetworkTransactionFees.halfHourFee, feeSliderValue: cachedNetworkTransactionFees.halfHourFee,
}); });
} }
} catch (_) {}
const recommendedFees = await NetworkTransactionFees.recommendedFees(); let recommendedFees = await NetworkTransactionFees.recommendedFees();
if (recommendedFees.hasOwnProperty('halfHourFee')) { if (recommendedFees.halfHourFee) {
await AsyncStorage.setItem(NetworkTransactionFee.StorageKey, JSON.stringify(recommendedFees)); await AsyncStorage.setItem(NetworkTransactionFee.StorageKey, JSON.stringify(recommendedFees));
this.setState({ this.setState({
fee: recommendedFees.halfHourFee, fee: recommendedFees.halfHourFee,