From 6992dc9c13c244bc6c260bd33ac45b1a7c6d0df8 Mon Sep 17 00:00:00 2001 From: Sean Matheson Date: Mon, 19 Aug 2019 16:08:30 +0100 Subject: [PATCH] Adds warning about invalid computed property access --- src/create-store-internals.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/create-store-internals.js b/src/create-store-internals.js index b5cbe1664..97495953b 100644 --- a/src/create-store-internals.js +++ b/src/create-store-internals.js @@ -227,7 +227,16 @@ export default function createStoreInternals({ } else if (references.getState == null) { return undefined; } else { - storeState = references.getState(); + try { + storeState = references.getState(); + } catch (err) { + if (process.env.NODE_ENV !== 'production') { + console.warn( + 'Invalid access attempt to a computed property', + ); + } + return undefined; + } } const state = get(parentPath, storeState); const inputs = computedMeta.stateResolvers.map(resolver =>