Nuxt UI Table disappears when using mutable field ref()
Hello All,
I am running into an issue where nuxt ui tables disappear after receiving data.
I have been pulling my hair out trying to figure out why, there is no error, or warnings.
Here is what I have tried so far:
- Initializing a
ref()
with static data - works
- Print ref value after setting the data after $fetch request - prints the mutable object and raw json when stringified [but the table disappears]
Does anyone know what could be going on?
Here is my full script:


3 Replies
Hi @23brewert. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Your issue—where the Nuxt UI Table disappears after setting data from a fetch—most likely stems from the structure or type of the data you assign to the table's data prop.
Key points from the Nuxt UI Table documentation:
- The
In your code, you do: If
This ensures the table always has a valid array to work with, even before data is loaded: 3. Assign the fetched array directly.
If your API returns
Log
The Nuxt UI Table requires the
data
prop for <UTable>
must be an array of objects. If you pass undefined
, null
, or a non-array value, the table will not render any rows, and may appear to "disappear" without errors or warnings.
- Initializing with static data works because it's always an array. When you fetch data, if products.value
is not an array (e.g., it's undefined
, null
, or an object), the table will not display anything.
- The table expects the array to be present immediately or after loading; if you set products.value = undefined
or a non-array during loading, it will not render rows until a valid array is assigned Nuxt UI Table: Data.
What to check:
1. Check the structure of your API response.In your code, you do: If
resp.items
is not an array, or if resp
is not the expected object, products.value
will not be an array.
2. Initialize your ref as an empty array.This ensures the table always has a valid array to work with, even before data is loaded: 3. Assign the fetched array directly.
If your API returns
{ items: [...] }
, you should do:
Avoid unnecessary serialization/deserialization unless you have a specific reason.
4. Debug the response.Log
resp
and resp.items
to ensure you are assigning an array:
Example fix:
Summary:The Nuxt UI Table requires the
data
prop to always be an array. If you assign undefined
, null
, or a non-array, the table will not render. Always initialize your ref as an array and ensure the fetched data is also an array before assigning it Nuxt UI Table: Data.
If you follow these steps and the issue persists, double-check the shape of your API response and how you assign it to products.value
.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@345465284582178826> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
FYI: I did check the request data [See print out in photos]