Hello, I'm creating a data-table component with shadcn/ui and I've noticed that when when I try to fetch the data and pass it to component It takes a little while to render, since the component takes a data prop of type <Stock[]>, but the data returned by the query adds an undefined type to it so I have to wait until Its successful then pass it to the component.
So I thought If of prefetching the query according to the docs to make it a little faster, but I get this error in the console and nothing changed pretty much.
Here is the code to the important files (since the post is too long I had to put in a file) and the error from the console:
**the error: **
Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ["stock"]
Warning: Encountered two children with the same key, `0`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
Warning: Encountered two children with the same key, `1`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.