remix icon indicating copy to clipboard operation
remix copied to clipboard

docs(sessions): Correction about commitSession in non-cookie sessions

Open penx opened this issue 1 year ago • 2 comments

Closes: #9444

  • [x] Docs
  • n/a Tests

The docs for createCookieSessionStorage state:

With other session storage strategies you only have to commit it when it's created

https://remix.run/docs/en/main/utils/sessions#createcookiesessionstorage

When we moved from createCookieSessionStorage to another storage solution (createKvSessionStorage from @vercel/remix), we followed this advice and removed calls to commitSession (assuming it was not needed, and that session.set would be all that is required) but it resulted in sessions not being saved.

Elsewhere in the docs for createSessionStorage:

updateData will be called from commitSession

https://remix.run/docs/en/main/utils/sessions#createsessionstorage

Which seems to imply that anything based on createSessionStorage will require a call to commitSession in order to update the session, and I'm fairly sure explains why we would have bugs when removing calls to commitSession.

penx avatar May 16 '24 15:05 penx

⚠️ No Changeset found

Latest commit: 149997cf3ccfdad7e9969b4edf86d212a1efc5ef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar May 16 '24 15:05 changeset-bot[bot]

@brophdawg11 anything needed to get this merged? 🙏

penx avatar Jun 14 '24 12:06 penx