#Access to React-query hooks from admin panel

4 messages · Page 1 of 1 (latest)

shadow saddle
#

Hi,

I am creating a new widget in the product page (see screenshot)
The widget I am creating will be used to generate EAN codes for the variants of the product.

Updating the EAN code of the variants works perfectly.
However, the UI does not refetch the latest data after my update/mutation.

I saw in the source code that React query is heavily used in the Admin UI and that there are so many react-query hooks that I could use.
They already invalidate the correct queries after an update has happened.

Problem is that I can't seem to find a way to update my UI after my mutation.

Is there any way that I can access these internal hooks?
Right now I am reinventing the hot water and it feels cumbersome.

haughty crane
#

Hey @shadow saddle,

We plan to make all the hooks available through @medusajs/admin-sdk but haven't had the time to move them yet. Will do so in one of the coming weeks. In the meantime, you can invalidate the product queries by invalidating the QueryKey ["products"] or ["products", "details"] if you just need to invalidate the product details page.

shadow saddle
#

Can i offer my help or too difficult to start with this ? Very familiar with Tanstack Query 🙂