From 8efba7094086038aeaf92d7b90d096a9c4b4adf3 Mon Sep 17 00:00:00 2001 From: Denis Loginov Date: Fri, 29 Sep 2017 18:16:40 +0000 Subject: [PATCH] Fix for unsupported includes() in unsorted_state_adapter CircleCI failed the build because includes() is not supported by its runtime yet. We use an alternative syntax to fix that. --- modules/entity/src/unsorted_state_adapter.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/entity/src/unsorted_state_adapter.ts b/modules/entity/src/unsorted_state_adapter.ts index 67d4d3bf10..5f23f2d8e9 100644 --- a/modules/entity/src/unsorted_state_adapter.ts +++ b/modules/entity/src/unsorted_state_adapter.ts @@ -66,11 +66,7 @@ export function createUnsortedStateAdapter( keys: { [id: string]: string }, update: Update, state: R - ): boolean { - if (!(update.id in state.entities)) { - return false; - } - + ): void { const original = state.entities[update.id]; const updated: T = Object.assign({}, original, update.changes); const newKey = selectId(updated); @@ -81,8 +77,6 @@ export function createUnsortedStateAdapter( } state.entities[newKey] = updated; - - return true; } function updateOneMutably(update: Update, state: R): boolean { @@ -92,9 +86,10 @@ export function createUnsortedStateAdapter( function updateManyMutably(updates: Update[], state: R): boolean { const newKeys: { [id: string]: string } = {}; - const didMutate = updates - .map(update => takeNewKey(newKeys, update, state)) - .includes(true); + const didMutate = + updates + .filter(update => update.id in state.entities) + .map(update => takeNewKey(newKeys, update, state)).length > 0; if (didMutate) { state.ids = state.ids.map(id => newKeys[id] || id);