26 Replies
I'm not but I've used Solid with react extensivly and the principles are mostly the same. Use the sanity client to query your cms, you can do it inside of server actions like any other query. do you have any specific questions or concerns with it?
Is more the
PortableText
, the package is for React
I'm new in Solid, try to learning
Already do a query (not sure if I do it the correct way) and it's working
oh yeah
GitHub
GitHub - portabletext/solid-portabletext: Render Portable Text with...
Render Portable Text with Solid. Contribute to portabletext/solid-portabletext development by creating an account on GitHub.
Oh thanks
One question that maybe is something that I'm doing wrong
When I navigate between pages the request to Sanity fails, but if I refresh the page everything works fine
I'm doing the fetching wrong?
And sorry for the questions :/
why be sorry? this is the place to ask 🙂
can i see the code you use to fetch? not the actual fetcher but the solid code
and maybe the fetching code as well
get-movies.ts
get-movies.query.ts
routes/index.tsx
https://docs.solidjs.com/solid-start/building-your-application/data-loading
I see an example from this docs
And on the route/page, I added:
I'm doing something wrong?I'm assuming your fetching code is working on the server but not on the client.
so when you navigate client side it the fetch fails
try putting "use server" at the top of your getMovies() function inside of cache()
Works
Should I do something different?
And other thing, is possible fetch the data while I hover the link?
I'm probably being a very noob, but it's normal this happen:
/movies/[slug].tsx
Only have this and put <a href={
/movies/${movie.slug}}>view details</a>
And whe I click on the view details
the URL is ok but the page appears blank, after a refresh the slug appears
Is very strangeBefore refresh
After refresh
I did another test:
- If I comment the fetch code and the
for
loop, and add a simpel button to /movies/abc
works
- If I access the route directly from the URL works
Otherwise notSometimes appear this error on console
this feels to me like a bug within solid start / vinxi
well, the sanity client not working on the server
your params aren't updating because you're destructuring which loses reactivity
Ok, so I should use
const params = useParams
yeah, because it's reactive
Ok, thank you and sorry for the noob mistakes 🫣
For the sanity client, should I do something different?
https://github.com/tutods/sanity-solid this is my code if you want to check
GitHub
GitHub - tutods/sanity-solid
Contribute to tutods/sanity-solid development by creating an account on GitHub.
Looks fine to me. Anything specific you want me to look at?
For now seems to be working
I will try to keep doing more queries with Sanity to see if works
Thanks for your help @b_e_n_t_e_n
🔥
And sorry for the noob questions
no need to apologize
Hi again
I'm facing a smiliar issue again
I have created this cta section, fetching the data from Sanity CMS
I added it to the
app.tsx
:
But it's rendering without data, the cta()
is undefined
This is my getCtaSettings
Anyone can help me please?