Tanstack doesn't setCookie on document reload except client side navigations
Basically, what the title says—I have a server function that sets a cookie and runs in beforeLoad. The server function is supposed to set a cookie. However, if you manually edit the URL and navigate to the page, the cookie doesn’t get set. But if you navigate to the page using client-side navigation, the cookie is set correctly.
Reproduction URL
https://codesandbox.io/p/devbox/youthful-curran-xl86qh
Check the index.tsx file—I have a server function that sets a cookie. To reproduce the issue:
1. Open the browser and remove any cookie named toast if it exists.
2. Reload the page. The expected behavior is that the cookie should be set, but it isn’t.
3. Now, navigate away from the page and return to it using client-side navigation. You’ll notice that the cookie gets set.
4 Replies
dependent-tan•7mo ago
GitHub
setCookie not working in latest version · Issue #3438 · TanStack/ro...
Which project does this relate to? Router Describe the bug setCookie doesn't work. It doesn't add a cookie. Your Example Website or App https://codesandbox.io/p/devbox/amazing-banach-y575zd...
unwilling-turquoiseOP•7mo ago
I think it the same thing
Seems like my explanation is just more comprehensive
dependent-tan•7mo ago
then please add this to the issue as a comment
unwilling-turquoiseOP•7mo ago
Done
THIS HAS BEEN FIXED