Next client component does not wait for middleware
Unanswered
American black bear posted this in #help-forum
American black bearOP
I have a client component that is looking for a specific value in the cookies. My middleware is setting a value for this cookie, but it looks like that the client component is not waiting for the middleware to execute the set to get the value because the client component is always getting the fallback value...
13 Replies
American black bearOP
const key = getCookie('key') ?? 'NN'the response is always
NN@American black bear `const key = getCookie('key') ?? 'NN'`
the response is always `NN`
show me your getCookie
function
and also did u check in the network tab
if the cookie is set
@gin if the cookie is set
American black bearOP
it is
@gin show me your getCookie
American black bearOP
it’s a function from cookies-next library
@American black bear it is
ur cookie is set but getCookie returns null?
if your cookie is httpOnly your client cant read it
check if it is
American black bearOP
it’s not
@gin ur cookie is set but getCookie returns null?
American black bearOP
yup i know
the question is why