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

Fix: Request money - Address field shows error when saved again and it becomes empty after refresh #26371

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/iou/WaypointEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function WaypointEditor({transactionID, route: {params: {iouType = '', waypointI

// If the user is online and they are trying to save a value without using the autocomplete, show an error message instructing them to use a selected address instead.
// That enables us to save the address with coordinates when it is selected
if (!isOffline && waypointValue !== '') {
if (!isOffline && waypointValue !== '' && waypointAddress !== waypointValue) {
errors[`waypoint${waypointIndex}`] = 'distance.errors.selectSuggestedAddress';
}

Expand Down
4 changes: 1 addition & 3 deletions src/pages/iou/WaypointEditorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,5 @@ WaypointEditorPage.displayName = 'WaypointEditorPage';
WaypointEditorPage.propTypes = propTypes;
WaypointEditorPage.defaultProps = defaultProps;
export default withOnyx({
// We must provide a default value for transactionID here, otherwise the component won't mount
// because withOnyx returns null until all the keys are defined
transactionID: {key: ONYXKEYS.IOU, selector: (iou) => (iou && iou.transactionID) || ''},
transactionID: {key: ONYXKEYS.IOU, selector: (iou) => iou && iou.transactionID},
})(WaypointEditorPage);