Was this helpful?

Cascaded Changes

When making mutations to the itinerary, you primarily make changes to a specific node (such as updateItinerary, updateItineraryLocation, etc). The effect of making a change may affect other elements of the itinerary.

To access any other affected nodes from the mutation, you can use the cascaded field which will supply the ability to query the affected nodes.

This assists you identify any stale date that may exist in your local memory or cache of your application and may indicate you need to update or refresh certain queries.

The following example shows the cascaded field which will read back affected nodes.

1# Creates an itinerary location and reads back any other changes to the
2# itinerary as a result of adding this location, such as additional calculated
3# directions when using auto route
4
5mutation CreateLocationWithCascadedChanges(
6  $itineraryId: ID!
7  $location: CreateItineraryLocationInput!
8) {
9  createItineraryLocation(itineraryId: $itineraryId, location: $location) {
10    # Read back the location just created
11    location {
12      __typename
13      id
14    }
15    # Select any other cascaded chages from the operation
16    cascaded {
17      created {
18        __typename
19        id
20        # Add any fields to read from created nodes
21      }
22      updated {
23        __typename
24        id
25        # Add any fields to read from created nodes
26      }
27      deletedIds
28    }
29  }
30}

Sandbox: Configure | Try Operation

alpaca.tech

Copyright © 2024 - Made with love ❤️ in Australia.