Skip to content

Commit

Permalink
add fix for issue: Bug in createSessionStorage remix-run#6594
Browse files Browse the repository at this point in the history
  • Loading branch information
naveed-fida committed Jun 13, 2023
1 parent fcaf2fd commit 73367c9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/remix-server-runtime/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,20 @@ export const createSessionStorageFactory =
},
async commitSession(session, options) {
let { id, data } = session;
let expires = cookie.expires;

if (options?.expires) {
expires = options.expires;
}

if (options?.maxAge) {
expires = new Date(Date.now() + options.maxAge * 1000);
}

if (id) {
await updateData(id, data, cookie.expires);
await updateData(id, data, expires);
} else {
id = await createData(data, cookie.expires);
id = await createData(data, expires);
}

return cookie.serialize(id, options);
Expand Down

0 comments on commit 73367c9

Please sign in to comment.