-
Notifications
You must be signed in to change notification settings - Fork 258
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
Many To Many Relation not working #5802
Comments
Hi @HusseinReda97pro, I'm sorry you are facing this issue. I will attempt to reproduce and get back to you |
Hello @HusseinReda97pro, we were able to reproduce the issue you described and marked it as a bug. We will update here once we have a fix. As a workaround we recommend creating your own join table to manage this many to many relationship. Gen 2 does not support the |
we use Gen 1 as Gen 2 does not support Datastore, and also for one to many relations I faced the same issue as the list marked with hasMany, not received when I query data so it another issue |
Hi @HusseinReda97pro, thanks for the response, we will investigate why hasMany is containing null values as well. |
Is there any update on this? It seems that the issue is still not resolved, as I am encountering the same problem with a many-to-many relationship and hasMany as well. |
@homer-blink, we do not have an update yet, but we will post here when we do. |
Description
when I declare Many To Many Relation and query models many-to-many list come with null value
Categories
Steps to Reproduce
GraphQL scheam
type Category @model @auth(rules: [{ allow: public }]) {
id: ID!
name: String!
order: Int
people: [Person] @manytomany(relationName: "PersonCategories")
}
type Taxonomy @model @auth(rules: [{ allow: public }]) {
id: ID!
name: String!
emoji: String
people: [Person] @manytomany(relationName: "PersonTaxonomies")
}
type Person @model @auth(rules: [{ allow: public }]) {
id: ID!
first_name: String!
last_name: String!
bio: String
city: String
country: String
image: String
job_title: String
organization: String
taxonomies: [Taxonomy] @manytomany(relationName: "PersonTaxonomies")
categories: [Category] @manytomany(relationName: "PersonCategories")
is_featured: Boolean
is_discoverable: Boolean
}
query person
final persons = await Amplify.DataStore.query(Person.classType);
print(persons.first.taxonomies);
taxonomies come with null value
and any many-to-many relation
also the data saved correct in data base and the GraphQL Request on API retrieve data
like this
Future customRequest2() async {
const document = '''
query GetPeople {
listPeople {
items {
id
first_name
last_name
bio
city
country
image
job_title
organization
is_featured
is_discoverable
industry {
id
name
}
taxonomies {
items {
id
taxonomy {
id
name
emoji
}
}
}
categories {
items {
id
category {
id
name
}
}
}
goals {
items {
id
goal {
id
name
}
}
}
}
}
}
''';
}
I don't know why DataStore does not retrieve taxonomies and categories with every person
Screenshots
No response
Platforms
Flutter Version
3.22.3
Amplify Flutter Version
^2.5.0
Deployment Method
Amplify CLI (Gen 1)
Schema
The text was updated successfully, but these errors were encountered: