@@ -50,6 +50,10 @@ export function data(
50
50
mutations : MutationStore ,
51
51
config : ApolloReducerConfig
52
52
) : NormalizedCache {
53
+ // XXX This is hopefully a temporary binding to get around
54
+ // https://github.com./Microsoft/TypeScript/issues/7719
55
+ const constAction = action ;
56
+
53
57
if ( isQueryResultAction ( action ) ) {
54
58
if ( ! queries [ action . queryId ] ) {
55
59
return previousState ;
@@ -81,16 +85,16 @@ export function data(
81
85
82
86
return newState ;
83
87
}
84
- } else if ( isMutationResultAction ( action ) ) {
88
+ } else if ( isMutationResultAction ( constAction ) ) {
85
89
// Incorporate the result from this mutation into the store
86
- if ( ! action . result . errors ) {
87
- const queryStoreValue = mutations [ action . mutationId ] ;
90
+ if ( ! constAction . result . errors ) {
91
+ const queryStoreValue = mutations [ constAction . mutationId ] ;
88
92
89
93
// XXX use immutablejs instead of cloning
90
94
const clonedState = assign ( { } , previousState ) as NormalizedCache ;
91
95
92
96
let newState = writeSelectionSetToStore ( {
93
- result : action . result . data ,
97
+ result : constAction . result . data ,
94
98
dataId : queryStoreValue . mutation . id ,
95
99
selectionSet : queryStoreValue . mutation . selectionSet ,
96
100
variables : queryStoreValue . variables ,
@@ -99,11 +103,11 @@ export function data(
99
103
fragmentMap : queryStoreValue . fragmentMap ,
100
104
} ) ;
101
105
102
- if ( action . resultBehaviors ) {
103
- action . resultBehaviors . forEach ( ( behavior ) => {
106
+ if ( constAction . resultBehaviors ) {
107
+ constAction . resultBehaviors . forEach ( ( behavior ) => {
104
108
const args : MutationBehaviorReducerArgs = {
105
109
behavior,
106
- result : action . result ,
110
+ result : constAction . result ,
107
111
variables : queryStoreValue . variables ,
108
112
fragmentMap : queryStoreValue . fragmentMap ,
109
113
selectionSet : queryStoreValue . mutation . selectionSet ,
0 commit comments