You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent create behavior when starting from hasMany vs belongsTo #8716
Say I have two models, Parent and Child and an instance of each parent and child respectively. Parent hasMany Child and Child belongsTo Parent.
Why is it that the association create behavior is different when creating the other? I expected the new instance returned from each create call.
createChildResult=awaitparent.createChild()// createChildResult is a new Child instance ✅createParentResult=awaitchild.createParent()// createParentResult is the same child??? ❌createParentResult===child// Why is this true???
The docs don't seem to cover this backwards behavior either. The return type is just listed as Promise with no types.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
Activity
stale commentedon Feb 27, 2018
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
geoffreak commentedon Feb 28, 2018
As far as I'm aware, this is still an issue.
sushantdhiman commentedon Mar 1, 2018
Hmm, looks like it does return same child model;s instance
Munter commentedon Oct 2, 2018
I just ran into the same issue. The behavior is quite surprising
fix(belongsto): create now returns target model (sequelize#8716)