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 1 commit
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
2 changes: 1 addition & 1 deletion src/pages/iou/WaypointEditorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pujan92 Have you read this comment? What do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this comment too as to me it makes sense in the DistanceRequestPage only. Bcoz in my mentioned proposal, transactionID will be available in the WaypointEditorPage when a user creates a new distance request and reach here.

// 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove then!

transactionID: {key: ONYXKEYS.IOU, selector: (iou) => (iou && iou.transactionID) || ''},
transactionID: {key: ONYXKEYS.IOU, selector: (iou) => iou && iou.transactionID},
})(WaypointEditorPage);
Loading