Now, every request will have the cookie updated with a new expiration date.
If you set the same cookie in your own loaders or actions, the middleware
will detect this and do nothing, so you can use the middleware and set the
cookie in your own code without worrying about it.
The rolling cookie middleware allows you to prolong the expiration of a cookie by updating the expiration date on every request.
First, create a rolling cookie middleware instance:
Then, add the
rollingCookieMiddleware
to theunstable_middleware
array in yourapp/root.tsx
file.Now, every request will have the cookie updated with a new expiration date.
If you set the same cookie in your own loaders or actions, the middleware will detect this and do nothing, so you can use the middleware and set the cookie in your own code without worrying about it.
Author
Sergio XalambrÃ