TypeError: rawData.some is not a function
Heya everyone.
I am running into an error that I've been trying to figure out for a few hours at this point.
I keep getting the following error when I go to my
http://localhost:3000/companies
page.
TypeError: rawData.some is not a function
In my _app.tsx
I have:
8 Replies
Hi @itsjamesmurray. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
useful-bronze•14mo ago
Then on my
./companies/index.tsx
I have:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The error message
TypeError: rawData.some is not a function
suggests that the rawData
object you're trying to use the some
method on is not an array. The some
method is an array method in JavaScript, and it won't work on non-array objects.
However, without more context or code, it's hard to pinpoint the exact issue. The code you've provided doesn't seem to directly relate to the error message you're seeing. It would be helpful to see the part of your code where rawData.some
is being called.
In the meantime, you might find it helpful to review the Refine documentation (https://refine.dev/docs) or the Refine blog (https://refine.dev/blog) for more information on how to properly set up and use Refine.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@845761203640205402> kapa.ai is still learning and improving, please let us know how it did by reacting below
useful-bronze•14mo ago
Confirmed that the api is sending data as expected:
And when using the AntdInferencer:
I am getting:
And just to ease my concerns around the API connection,
./companies/show
and /companies/edit/[id]
work as intended
@kapa.ai any reasons why it would work in /edit
and /show
but my list wont work?Let me check the knowledge base for you. One moment! :books:
----------------------
Based on the information provided in the extracts, it's hard to provide a definitive answer. However, the issue might be related to how the data is being fetched or structured for your list page compared to your edit and show pages.
In Refine, the
list
page typically involves fetching and displaying a list of records, while the edit
and show
pages usually deal with a single record. If your API endpoint for fetching the list of companies is returning data in a format that's not an array, it could cause issues when Refine tries to process the data for the list page.
It's also worth noting that the useTable
hook is used for fetching data and managing the table state on the list page. If there's an issue with how this hook is being used, it could potentially cause problems on your list page.
For more information, you might want to check out the Refine documentation on adding CRUD pages (https://refine.dev/docs/tutorial/adding-crud-pages/headless/index) and the Refine documentation on the useTable hook (https://refine.dev/docs/packages/documentation/react-table/).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@845761203640205402> kapa.ai is still learning and improving, please let us know how it did by reacting below
useful-bronze•14mo ago
SOLVED
Had to change the function a bit after some trial and error: