File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,20 @@ query Partner($input: ID!) {
6
6
7
7
fragment partnerDetails on Partner {
8
8
... Id
9
- createdAt
9
+ ... partnerOwnDetails
10
10
organization {
11
11
canRead
12
12
canEdit
13
13
value {
14
14
... organizationDetails
15
15
}
16
16
}
17
+ }
18
+
19
+ # Seperated for UpdatePartner mutation
20
+ fragment partnerOwnDetails on Partner {
21
+ ... Id
22
+ createdAt
17
23
pointOfContact {
18
24
canRead
19
25
canEdit
Original file line number Diff line number Diff line change @@ -4,7 +4,20 @@ mutation UpdatePartner(
4
4
) {
5
5
updatePartner (input : { partner : $partner }) {
6
6
partner {
7
- ... partnerDetails
7
+ # Organization data cannot be fetched here as it will be stale.
8
+ #
9
+ # The API executes these two mutations in parallel, independently.
10
+ # `Partner.organization` doesn't know it there's another organization update going on,
11
+ # and will return the stale data.
12
+ # Apollo Client would then receive two sets of org data:
13
+ # - `updateOrganization.organization` result
14
+ # - `updatePartner.partner.organization` result
15
+ # They will be conflict, with the former fresh, and the latter stale.
16
+ # We can avoid this race / nondeterministic behavior by only returning one org data set.
17
+ #
18
+ # Also, Apollo Client still has the normalized organization for the partner record,
19
+ # so it knows how to connect it together when requested for the detail page.
20
+ ... partnerOwnDetails
8
21
}
9
22
}
10
23
updateOrganization (input : { organization : $organization }) {
You can’t perform that action at this time.
0 commit comments