Shopify / ui-extensions

MIT License
249 stars 35 forks source link

selected order does not update on admin.order-details.block.render extension when user navigates between orders #1971

Closed zachsitka closed 2 weeks ago

zachsitka commented 1 month ago

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

@shopify/ui-extensions-react version 2024.4.1

Describe the bug

When users navigate from one order-details page to another without leaving the order details page the selected items returned via the useApi function do not change. The selected items is always the same as when the extension was first loaded on the page.

Navigation events that trigger this issue: Using the <> buttons Searching for an order in the search bar and clicking on a result

Steps to reproduce the behavior:

Setup:

  1. Create admin.order-details.block.render extension. Make this extension display something about the order (you can just display the id, that should be fine)
  2. Open up an order details page and pin the extension to the page

Steps:

  1. Open an order with a admin.order-details.block.render extension
  2. Add the extension into the App Blocks section if you have not already added it and pinned it there
  3. Extension is given a data object such that data.selected[0] corresponds to the order that is visible on the page
  4. Navigate to a new order using the <> buttons, or type in a new order id in the search bar and click on the result
  5. You are navigated to a new page
  6. The extension is not updated about the change in the displayed order. The data.selected[0] object corresponds to the previous order. There are also no other orders in the selected array.

Expected behavior

I would expect that the data.selected array would update so that you are always seeing the order that is currently being displayed. Otherwise the extension is not actually displaying the correct information based on the order that is on the page around it.

AaronSpringut commented 1 month ago

Hey Zach, thanks for reporting. I was able to reproduce, this is definitely broken. We'll get a fix lined up for this.

shoheikawano commented 2 weeks ago

Hi, just curious; any update on this?

MitchLillie commented 2 weeks ago

Hey Zach -- this should now be fixed. Take a look and let us know if you have any other issues!

cc @shoheikawano

shoheikawano commented 1 week ago

@MitchLillie The fix confirmed! The extension now behaves as expected. Thanks!