You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sql template literal uses @neondatabase/serverless, which uses fetch. When using this function in Next.js, this causes the result to be automatically cached.
As this function does not expose the fetch options, it is only possible to set them per rout not per-request. This means that (as far as I'm aware) you:
Cannot set tags to allow the use of revalidateTag
Cannot have different revalidation conditions for different requests on the same page (e.g. revalidate a list of comments more often than a blog post)
The neon functions called allow you to pass fetch options, but this library does not (as far as I can tell) provide a way for a developer to provide them.
I created an example of how these options could be passed here. In this example you would have the option of replacing db.sql'...' with db.withFetchOptions(...).sql'...' to set the options used by fetch without altering the behaviour of the original.
The text was updated successfully, but these errors were encountered:
The
sql
template literal uses @neondatabase/serverless, which usesfetch
. When using this function in Next.js, this causes the result to be automatically cached.As this function does not expose the fetch options, it is only possible to set them per rout not per-request. This means that (as far as I'm aware) you:
revalidateTag
The neon functions called allow you to pass fetch options, but this library does not (as far as I can tell) provide a way for a developer to provide them.
I created an example of how these options could be passed here. In this example you would have the option of replacing
db.sql'...'
withdb.withFetchOptions(...).sql'...'
to set the options used by fetch without altering the behaviour of the original.The text was updated successfully, but these errors were encountered: