Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Jul 16, 2021
1 parent bb02d77 commit 8d8745b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/components/IOUConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,19 @@ const propTypes = {
/** Whether or not the IOU step is loading (creating the IOU Report) */
loading: PropTypes.bool,
}),

/** Information about the network */
network: PropTypes.shape({
/** Is the network currently offline or not */
isOffline: PropTypes.bool,
}),
};

const defaultProps = {
iou: {},
onUpdateComment: null,
comment: '',
network: {},
};

// Gives minimum height to offset the height of
Expand Down Expand Up @@ -274,8 +281,14 @@ class IOUConfirmationList extends Component {
</View>
</ScrollView>
<FixedFooter>
{this.props.network.isOffline && (
<Text style={[styles.formError, styles.pb2]}>
{this.props.translate('session.offlineMessage')}
</Text>
)}
<Button
success
isDisabled={this.props.network.isOffline}
style={[styles.w100]}
isLoading={this.props.iou.loading}
text={buttonText}
Expand All @@ -301,5 +314,8 @@ export default compose(
myPersonalDetails: {
key: ONYXKEYS.MY_PERSONAL_DETAILS,
},
network: {
key: ONYXKEYS.NETWORK,
},
}),
)(IOUConfirmationList);
10 changes: 7 additions & 3 deletions src/libs/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ function processNetworkRequestQueue() {
}

// If we have a request then we need to check if it can be persisted in case we close the tab while offline
const retryableRequests = _.filter(networkRequestQueue, request => (
!request.data.doNotRetry && request.data.persist
));
const retryableRequests = [];
_.each(networkRequestQueue, (request) => {
if ((request.data.doNotRetry || request.data.forceNetworkRequest) && !request.data.persist) {
return request.resolve();
}
retryableRequests.push(request);
});
Onyx.set(ONYXKEYS.NETWORK_REQUEST_QUEUE, retryableRequests);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/PersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function fetchCurrencyPreferences() {
isRetrievingCurrency: true,
});

API.GetPreferredCurrency({...coords})
API.GetPreferredCurrency({...coords, doNotRetry: true})
.then((data) => {
currency = data.currency;
})
Expand Down

0 comments on commit 8d8745b

Please sign in to comment.