Simple Inverse One To One Relationship throws error "related is undefined" #1788
Unanswered
pixelmusik
asked this question in
Q&A
Replies: 1 comment
-
Please provide a reproduction 🙏 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When implementing a simple one-to-one relationship (e.g. user has phone) everything works fine. But when I add the inverse relationship on the related model (e.g. phone belongs to user) as described in the official documentation, I am getting a JS error in the console.
"Uncaught (in promise) TypeError: related is undefined"
It seems that it is impossible to have an inverse relationship along with the one-to-one relationship. I can have either a hasOne relationship on the original model or a belongsTo relationship on the related model but not both? My two models "User" and "Phone" look exactly the same as described in the documentation: https://pinia-orm.codedredd.de/guide/relationships/one-to-one
What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions