Data cannot be displayed on UI kbar with useQuery

59 Views Asked by At

I am really confused about my case, when I fetch data with useQuery inside a component in react and the data not displayed on Kbar Library(input search). But when I see console.log the data displayed, and I tried to create dummy array and go to mapping, the data display on UI.

this code below the data won't display on UI

`

const gparam = {
  search: {
    type: [{ operator: 'eq', value: 'digital_product' }]
  }
};
export function useSearchActions() {
  const { data: dataKbar } = useQuery(GQL_PAYMENTLINK_KBAR, { variables: gparam });

  const coba = useMemo(() => {
    // const actions = [];
    const actions =
      dataKbar?.getPaymentLinkPage?.items?.map(aya => {
        return {
          id: 'aya.id',
          // parent: parentId.cobaRoot,
          // subtitle:"ah",
          name: aya.name,
          keywords: 'coba',
          section: 'digital produk',
          perform: () => (window.location.pathname = `/digital-product-detail/${aya.id}`)
        };
      }) || [];

    return actions;
  }, []);

}

`

but when I create a dummy array and maping like above data, the data will be display on UI, have any idea why the data not display on UI when I map data with useQuery?

0

There are 0 best solutions below