Skip to content

fix: persistSession parameter does not work as expected#61

Merged
AlexV525 merged 3 commits intoflutterchina:mainfrom
ndelanou:fix/persist-session
Feb 27, 2026
Merged

fix: persistSession parameter does not work as expected#61
AlexV525 merged 3 commits intoflutterchina:mainfrom
ndelanou:fix/persist-session

Conversation

@ndelanou
Copy link
Contributor

@ndelanou ndelanou commented Oct 7, 2025

Closes #55

The current logic handling persistSession is wrong: (isSession && persistSession) || (persistSession && !cookie.isExpired())

With persistSession to true (default behavior), cookies are saved if they are either a session cookie (max-age == null && expires == null) or not expired. Works perfectly ✅

When persistSession is false, every cookie is rejected. This is a huge issue ⚠️

I changed the logic in charge of filtering the cookies to be saved.

I also added some tests covering this fix.

@ndelanou ndelanou force-pushed the fix/persist-session branch from cbe9c89 to 491fab2 Compare October 7, 2025 14:03
Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@AlexV525 AlexV525 merged commit 2435068 into flutterchina:main Feb 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-session Cookies won't saved without persistSession flag

2 participants