Closed mordechaim closed 1 week ago
The fix should be simple, since we are in a server component, mark the function with async
and call the function with await
Released under 2.0.0-alpha.0.
Can you check?
No warnings now, useCookies()
works perfectly.
Although I never use it in my app, I did test getCookies()
as well (what's the purpose, we can just use cookies()
?). It now properly returns a promise, but Typescript doesn't detect it as such:
'await' has no effect on the type of this expression
Thank you. You're right. I've update the types on version 2.0.0-alpha.1
.
The getCookies()
is just a wrapper, but it provide the same interface as you have on the client side so it's useful if you need to share cookies logic.
This warning is gone now, works perfectly
Great!
I will keep this issue open until Next.js canary is officially released and we can release it as well.
Thanks for the fix, Next 15 is now stable
Available now under v2.0.0
The following code: https://github.com/moshest/next-client-cookies/blob/68439a612ab339307ff833cadd2ac8ff6c730ed5/src/server.tsx#L9
Triggers a warning on
next@canary
:Rational