Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(model): fix unchained promise in association logic in bulkCreate #12163

Merged
merged 2 commits into from
Apr 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@ class Model {
const associationInstance = createdAssociationInstances[idx];
const instance = associationInstanceIndexToInstanceMap[idx];

instance[include.association.accessors.set](associationInstance, { save: false, logging: options.logging });
await include.association.set(instance, associationInstance, { save: false, logging: options.logging });
Copy link
Contributor

Choose a reason for hiding this comment

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

save: false, means this will not return promise. So await is not useful here. Why accessors is being removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the set function were converted to async so they always return a promise now.
Using accessors.set was only used to look up the instance set method which is effectively just a proxy (see helpers.js:64) seemed redundant to me 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes, it is an async method now. That make sense

}
}));
}
Expand Down