Can't get createServerData$ to work as expected
I have other projects that use routeData / createServerData$ / useRouteData that work fine. This one is giving me fits.
In the below, trying to read the records() accessor gives me "records is not a function"
My prisma schema/client are cool, typings there are good. I've reduced the code to a minimal example and it still doesn't work. I've tried everything I know, and still no joy. Ideas anyone? Thanks
7 Replies
async await that fn in createServerData$
Edited code above to include async/await. Did not change the outcome unfortunately.
can you debug and put breakpoint at const data = await prisma.company.findMany({})
@Nikos thanks for the replies. I think my problem was that my route component was re-exporting the above from another location in the project. It seems that solid-start requires that my routeData/createServerData$ code physically live in the route component itself (?). If I bring that code into the route component itself, then things work.
hi. i found the solution
cool
@totskie730 thank you, this works great. I was over-invested in trying to make a specific approach (using
useRouteData
example from the docs) and didn't know how to refactor for my specific case. Appreciate your taking the time to post a working solution.