Skip to content

Commit 41b1ce3

Browse files
committed
refactor: remove unnecessary condition and add clarifying comment
1 parent dc7966c commit 41b1ce3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/model.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,10 @@ Model.prototype.$__handleSave = function(options, callback) {
290290

291291
const session = this.$session();
292292
const asyncLocalStorage = this[modelDbSymbol].base.transactionAsyncLocalStorage?.getStore();
293-
if (!saveOptions.hasOwnProperty('session') && session != null) {
293+
if (session != null) {
294294
saveOptions.session = session;
295295
} else if (!options.hasOwnProperty('session') && asyncLocalStorage?.session != null) {
296+
// Only set session from asyncLocalStorage if `session` option wasn't originally passed in options
296297
saveOptions.session = asyncLocalStorage.session;
297298
}
298299
if (this.$isNew) {

0 commit comments

Comments
 (0)