Query revalidation
Hello Solid community
I want suggestions on query revalidation. I have this 'problem' where I have an API route
I am not really sure what's the syntax for 'revalidate: [] || string' I am passing in a string which is the key name of the query function
that protects the
I am thinking that why my code won't work properly is because revalidation happens before the cookie is set so I never get access to updated cookie from getRequestEvent()
Since I am seeking suggestions I have some questions:
1. Is it a good practice to protect routes with query functions?
2. What's the syntax for revalidation?, as far as I understand we can have query function name like
3. Does the next query function get updated cookies when revalidated?, because the revalidate does revalidate the query but I don't see the updated cookie: getRequestEvent().request.headers.get('cookie') is
Since the above code didn't work I am not including queries for protected routes anymore, maybe there is a workaround/better way of doing this.
I want suggestions on query revalidation. I have this 'problem' where I have an API route
export async function GET which should redirect to the protected route if user qualifies for next route /reset/password, and while redirection it should revalidate the query function that protects the route
return redirect('/reset/password', {
status: 303,
revalidate: ['protect-reset-password'],
headers: {
'Set-Cookie': reset_session=${user_id}; Path=/; Max-Age=600; HttpOnly; Secure; SameSite=Strict
},
})
I am not really sure what's the syntax for 'revalidate: [] || string' I am passing in a string which is the key name of the query function
that protects the
/reset/password routeexport const ProtectResetPassword = query(async () => {...}, 'protect-reset-password')I am thinking that why my code won't work properly is because revalidation happens before the cookie is set so I never get access to updated cookie from getRequestEvent()
Since I am seeking suggestions I have some questions:
1. Is it a good practice to protect routes with query functions?
2. What's the syntax for revalidation?, as far as I understand we can have query function name like
queryfunction.key or cache key name itself(the 2nd argument(string) that we pass to the query function). if we are passing parameters to that query we could have queryfunction.keyFor(parameter_to_revalidate_for). I want to clarify this3. Does the next query function get updated cookies when revalidated?, because the revalidate does revalidate the query but I don't see the updated cookie: getRequestEvent().request.headers.get('cookie') is
null Since the above code didn't work I am not including queries for protected routes anymore, maybe there is a workaround/better way of doing this.

SolidStart