-
Notifications
You must be signed in to change notification settings - Fork 222
test(datastore): Lazy loading integration tests #2448
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
Changes from all commits
fd0d131
c80e2f6
805cb05
4eabd82
42a5f55
0032891
5282d38
0fdcfcb
b26516a
b5025b8
b7b457a
7122f99
1be5581
5c0a135
f49355f
df222d0
865da63
8e55e6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,7 +102,6 @@ extension Statement: StatementModelConvertible { | |
| from: value, | ||
| fieldType: field.type | ||
| ) | ||
|
|
||
| // Check if the value for the primary key is `nil`. This is when an associated model does not exist. | ||
| // To create a decodable `modelDictionary` that can be decoded to the Model types, the entire | ||
| // object at this particular key should be set to `nil`. The following code does that by dropping the last | ||
|
|
@@ -135,7 +134,10 @@ extension Statement: StatementModelConvertible { | |
| // For example, when the value is the `id` of the Blog, then the field.isPrimaryKey is satisfied. | ||
| // Every association of the Blog, such as the has-many Post is populated with the List with | ||
| // associatedId == blog's id. This way, the list of post can be lazily loaded later using the associated id. | ||
| if let id = modelValue as? String, field.isPrimaryKey { | ||
| if let id = modelValue as? String, | ||
| (field.name == ModelIdentifierFormat.Custom.sqlColumnName || // this is the `@@primaryKey` (CPK) | ||
| (schema.primaryKey.fields.count == 1 // or there's only one primary key (not composite key) | ||
| && schema.primaryKey.indexOfField(named: field.name) != nil)) { // and this field is the primary key | ||
|
Comment on lines
+137
to
+140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bug where lazy List was not being created due to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| let associations = schema.fields.values.filter { | ||
| $0.isArray && $0.hasAssociation | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug where collections's are being set to
nilin the GraphQL input, so for example, when creating a Post and saving it through DataStore. the sync process will translate the post to the GraphQL input variables containingThe problem is this fails as there's no input type "comments". We should skip has-many relationships like in this code snippet. This can be done in
mainandv1There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2483