From 4371e7fd1b89244f9b9fa7f6da184afdeae14273 Mon Sep 17 00:00:00 2001 From: David Alan Hjelle Date: Tue, 12 Jul 2016 17:01:49 -0500 Subject: [PATCH] Fix map function returning undefined. --- CHANGELOG.md | 2 ++ src/data/mutationResults.ts | 6 +++--- test/mutationResults.ts | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a17a8540400..31976cf30c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Expect active development and potentially significant breaking changes in the `0 ### vNEXT +- Fix map function returning `undefined` in `removeRefsFromStoreObj`. [PR #393](https://github.com/apollostack/apollo-client/pull/393) + ### v0.4.1 - Allow `client.mutate` to accept an `optimisticResponse` argument to update the cache immediately, then after the server responds replace the `optimisticResponse` with the real response. [Issue #287](https://github.com/apollostack/apollo-client/issues/287) [PR #336](https://github.com/apollostack/apollo-client/pull/336) diff --git a/src/data/mutationResults.ts b/src/data/mutationResults.ts index 638e2553008..746f5002136 100644 --- a/src/data/mutationResults.ts +++ b/src/data/mutationResults.ts @@ -183,10 +183,10 @@ function removeRefsFromStoreObj(storeObj, dataId) { affected = true; return filteredArray; } - - // If not modified, return the original value - return value; } + + // If not modified, return the original value + return value; }); if (affected) { diff --git a/test/mutationResults.ts b/test/mutationResults.ts index 4e71d86268c..bff8f6223dc 100644 --- a/test/mutationResults.ts +++ b/test/mutationResults.ts @@ -446,6 +446,8 @@ describe('mutation results', () => { // The item shouldn't be in the store anymore assert.notProperty(client.queryManager.getApolloState().data, 'Todo3'); + // shouldn't have affected other data elements + assert.notEqual(client.queryManager.getApolloState().data['TodoList5']['__typename'], undefined); }); }); });