URL generation API, server-side rendering, and hydration problems

caprica
caprica Member Posts: 9
edited November 2023 in Developer APIs

I am using url-gen to generate image URLs in a Remix application, although I imagine this would be the same issue with any server-side rendering framework.

Basically, I get hydration errors when I generate URLs due to a mismatch in client vs server rendering.

For example, server renders something like this:

https://res.cloudinary.com/xxxxxxx/image/upload/v1/whatever/filename?_a=BATASxa20

Client subsequently renders this:

https://res.cloudinary.com/xxxxxxx/image/upload/v1/whatever/filename?_a=BATASxAA0

You can see this "?_a" query parameter value is different each time, and so I am forced down an error path, or at least a sub-optimal path whereby Remix switches everything to client-side rendering.

Tagged:

Best Answer