Closed andrepimpao closed 2 years ago
You're right haven't tested it in a while and should write a test for it. I generally recommend not to use rolling since it will generate and set the cookie with every request which might cause overhead. Another idea would be to give the option to refresh the session If a certain percentage of the expiry is met and remove the rolling option.
That actually seems like a great idea. Maybe instead of removing, just give the possibility to set a percentage value like:
false
never refreshestrue
always refreshes[0-100]%
refreshes when a percentage of the expiration date is metThis is now available in v2.1.3 https://github.com/pixelmund/svelte-kit-cookie-session/commit/eaa0274cb6fbf876b67ff79bfc8fc79536cb0ef0
It seems that setting
rolling
totrue
does not refresh the expiration date. When usingsession.refresh()
it seems to work fine.From what I can tell, this condition always fails because sessionData is always undefined: