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: changes made to address book does not reflect in UI #747

Merged
merged 2 commits into from
Feb 9, 2021

Conversation

jrw421
Copy link
Contributor

@jrw421 jrw421 commented Feb 1, 2021

Signed-off-by: jrw421 jessica.wolvington@gmail.com

Resolves #744
Impact: minor
Type: bugfix

Issue

Upon adding a new address or deleting an address the changes do not reflect immediately on UI. It only takes effect after browser refresh. The changes are persisted at DB level. Deleting a pre deleted address gives an appropriate address not found GraphQL error.

Steps to reproduce the behavior:

  1. On the storefront UI go to Profile - > Address Book
  2. Add or delete an address.
  3. Navigate to Orders on the same page and go back to Address Book. The list is not updated with the cahange.
  4. Navigate out of the profile page (maybe home page or cart. Explore some products). Go back to address book. The list is not updated with the change.
  5. Refresh the browser. The list is now updated with the change.

Solution

This was solved by adding a placeholder in the destructuring of the useViewer hook. It's possible that the hook was updated and the add/delete account files were not updated to reflect the change. The useViewer hook exports three items, the last of which was necessary to reflect the updates to the addresses (refetchViewer). Since the original code was only destructuring two items, the refetchViewer was ultimately the wrong item and wasn't being called as expected.

Note: The unused import is being destructured as an empty string to avoid no-unused-var linting issues. Happy to alter this if preferred.

Breaking changes

None expected.

Testing

  1. On the storefront UI go to Profile - > Address Book
  2. Add or delete an address.
  3. The changes should immediately be reflected in the address book.

Copy link
Contributor

@MohanNarayana MohanNarayana left a comment

Choose a reason for hiding this comment

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

The fix works. Please correct the commit message.

Signed-off-by: jrw421 <jessica.wolvington@gmail.com>
@jrw421 jrw421 force-pushed the fix-744-jrw421-address-update branch from 6ce0dd6 to bad5983 Compare February 5, 2021 17:52
Copy link
Contributor

@MohanNarayana MohanNarayana left a comment

Choose a reason for hiding this comment

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

Great job!

@jrw421 jrw421 merged commit 17a352c into trunk Feb 9, 2021
@jrw421 jrw421 deleted the fix-744-jrw421-address-update branch February 9, 2021 17:32
@MohanNarayana MohanNarayana mentioned this pull request Feb 9, 2021
@Akarshit Akarshit mentioned this pull request Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes made to address book does not reflect in UI
2 participants