Admin Block Extension useApi `data` object's `selected` property is empty when targeting orders view

_miles
Shopify Partner
1 0 0

I am actively developing an Admin Block extension for my app.

 

My target is const TARGET = 'admin.order-details.block.render'.

 

My app is installed and configured with these scopes: "write_products,read_orders,write_orders,read_products,write_order_edits"

 

Using package versions:

  • "@shopify/ui-extensions-react": "2023.10.0"
  • "@shopify/app": "3.48.0"
  • "@shopify/cli": "3.48.0"

 

While developing today (running `shopify app dev` via CLI) I observed that now when my block extension desctructures the response from the `useApi` hook, the `data` object's `selected` property is an empty array:

 

// index.tsx
import React from 'react'
import { useApi, reactExtension } from '@shopify/ui-extensions-react/admin' 

const TARGET = 'admin.order-details.block.render'

export default reactExtension(TARGET, () => <App />)

export const App = (): React.ReactElement => {
  const { data } = useApi(TARGET)

  // Until today, orderId was defined, but now it is undefined:
  const orderId = data.selected[0].id
  console.log(orderId) // -> undefined

  console.log(data.selected) // -> []

  // ... 
}

 

This is not the case for the Admin Action extension I am developing - that `data` object's `selected` property still looks correct:

 

[ { "id": "gid://shopify/Order/123456789" } ]

 

Was a bug recently introduced? I am aware that this feature is still in developer preview, but if there is a bug, I'd just like to raise the issue. If not, am I doing something incorrectly here? This was working last week and I didn't change anything on my end over the weekend. Thanks in advance.

Reply 1 (1)

Liam
Shopify Staff
2731 293 744

Hi Miles,

 

Are you still experiencing this issue?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog