@@ -50,6 +50,10 @@ export function data(
5050 mutations : MutationStore ,
5151 config : ApolloReducerConfig
5252) : 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+
5357 if ( isQueryResultAction ( action ) ) {
5458 if ( ! queries [ action . queryId ] ) {
5559 return previousState ;
@@ -81,16 +85,16 @@ export function data(
8185
8286 return newState ;
8387 }
84- } else if ( isMutationResultAction ( action ) ) {
88+ } else if ( isMutationResultAction ( constAction ) ) {
8589 // 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 ] ;
8892
8993 // XXX use immutablejs instead of cloning
9094 const clonedState = assign ( { } , previousState ) as NormalizedCache ;
9195
9296 let newState = writeSelectionSetToStore ( {
93- result : action . result . data ,
97+ result : constAction . result . data ,
9498 dataId : queryStoreValue . mutation . id ,
9599 selectionSet : queryStoreValue . mutation . selectionSet ,
96100 variables : queryStoreValue . variables ,
@@ -99,11 +103,11 @@ export function data(
99103 fragmentMap : queryStoreValue . fragmentMap ,
100104 } ) ;
101105
102- if ( action . resultBehaviors ) {
103- action . resultBehaviors . forEach ( ( behavior ) => {
106+ if ( constAction . resultBehaviors ) {
107+ constAction . resultBehaviors . forEach ( ( behavior ) => {
104108 const args : MutationBehaviorReducerArgs = {
105109 behavior,
106- result : action . result ,
110+ result : constAction . result ,
107111 variables : queryStoreValue . variables ,
108112 fragmentMap : queryStoreValue . fragmentMap ,
109113 selectionSet : queryStoreValue . mutation . selectionSet ,
0 commit comments