Skip to content

Commit

Permalink
remove optimisticResponse property on mutation actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Slava committed Jul 12, 2016
1 parent c16e400 commit ea1b746
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
2 changes: 0 additions & 2 deletions src/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ export class QueryManager {
result,
mutationId,
resultBehaviors,
optimisticResponse,
});

return result;
Expand All @@ -285,7 +284,6 @@ export class QueryManager {
error: err,
mutationId,
resultBehaviors,
optimisticResponse,
});

return Promise.reject(err);
Expand Down
1 change: 0 additions & 1 deletion src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export interface MutationResultAction {
type: 'APOLLO_MUTATION_RESULT';
result: GraphQLResult;
mutationId: string;
optimisticResponse: Object;
resultBehaviors?: MutationBehavior[];
}

Expand Down
3 changes: 1 addition & 2 deletions src/optimistic-data/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export function optimistic(
type: 'APOLLO_MUTATION_RESULT',
result: { data: action.optimisticResponse },
mutationId: action.mutationId,
optimisticResponse: null,
resultBehaviors: action.resultBehaviors,
} as ApolloAction;

Expand All @@ -64,7 +63,7 @@ export function optimistic(

return newState;
} else if ((isMutationErrorAction(action) || isMutationResultAction(action))
&& action.optimisticResponse) {
&& previousState.some(change => change.mutationId === action.mutationId)) {
// throw away optimistic changes of that particular mutation
const newState = previousState.filter(
(change) => change.mutationId !== action.mutationId);
Expand Down

0 comments on commit ea1b746

Please sign in to comment.