Closed sdenadai closed 4 months ago
Thank you @sdenadai for reporting this. I can confirm that this is an issue after following your steps to reproduce. I'm going to tag this issue so it makes its way into our ticketing system.
In the meantime, a simple work around would be to re-fetch that customer information with the addresses using the "useCurrentCustomer" hook.
This issue has been linked to a new work item: W-16151037
Summary
Opening the Account page, a request with the
useCurrentCustomer
hook is made. The response contains anaddresses
key with the user addresses.If you edit the profile (for example changing the first name), and press save, the mutation called with
useShopperCustomersMutation('updateCustomer')
overwrites the response of theuseCurrentCustomer
deleting theaddresses
key.Doing so, if you go to the Addesses section of the user account page you don't see any addresses. Still, they reappear if you force a page reload performing a fresh
useCurrentCustomer
call.Steps To Reproduce
This issue can easily be seen on the official pwa-kit demo (https://pwa-kit.mobify-storefront.com/).
Expected result
Editing the user profile shouldn't remove necessary account data from the response
Actual result
The cached useCurrentCustomer response (seen from the React Tanstack Query Debug tool) loses the addresses key after saving the user profile.
System Information (as applicable)
Browser: Google Chrome Node version: 18.15.0 pwa-kit version: Tested on 3.1.0 and 3.6.0 Desktop OS: macOS Mobile Device Info: -