Shopify / ui-extensions

MIT License
269 stars 35 forks source link

Post purchase extension API storage.update failed #1645

Open CBCzed opened 10 months ago

CBCzed commented 10 months ago

Please list the package(s) involved in the issue, and include the version you are using

Describe the bug

In one page checkout,Post purchase extension API Checkout::PostPurchase::ShouldRender is called and the data is stored in localStorage using storage.update in the callback function. But sometimes the storage.initialData is undefined through the useExtensionInput<'Checkout::PostPurchase::Render'>() API

Steps to reproduce the behavior:

  1. Go to the checkout page, get the render data in the callback function of Checkout::PostPurchase::ShouldRender and use storage.update to store the data.
  2. After the user completes the payment and enters the OCU, we get results from extension api and the data is null.

Expected behavior

The data can be obtained normally.

Screenshots

These two images show our code.

image image

The handleReportRender function in the two screenshots above is the function we use to collect the logs.

These image shows the logs we collected during the Post purchase extension point Checkout::PostPurchase::ShouldRender phase.

image

These image shows the logs we collected during the Post purchase extension point Checkout::PostPurchase::Render phase. we get results from extension api and the data is null.

image

Additional context

No.

rickykissoon commented 1 week ago

Bumping this issue because I'm also having issues with storage data failing. This issue only happens in production, it works as expected on my development store. In production Checkout::PostPurchase::ShouldRender gets called and the api properly returns the needed data and calls storage.update to store the data. Then on the post purchase page I'm using the useExtensionInput hook to retrieve the data, the page renders fine but storage returns undefined (only in production, it works in development).