Skip to content

Commit

Permalink
fix(core): do not set undefined value to resources, fix #166
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 13, 2023
1 parent bc27bbf commit 7e53297
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export function defineAccessor(prototype: {}, name: string, keys: string[]) {
return keys.reduce((data, key) => data?.[key], this)
},
set(value) {
// Do not set undefined value
// See https://github.com/satorijs/satori/issues/166
if (value === undefined) return
const _keys = keys.slice()
const last = _keys.pop()
const data = _keys.reduce((data, key) => data[key] ??= {}, this)
Expand Down

0 comments on commit 7e53297

Please sign in to comment.