From 0811c9302d375762f0691ae682cdf1b4146296e2 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 23 Aug 2017 17:30:46 +0700 Subject: [PATCH] Ignore access from react dev tools --- client/coral-framework/services/plugins.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/coral-framework/services/plugins.js b/client/coral-framework/services/plugins.js index f51e33702..5474e919f 100644 --- a/client/coral-framework/services/plugins.js +++ b/client/coral-framework/services/plugins.js @@ -31,8 +31,13 @@ function withWarnings(component, queryData) { return new Proxy(queryData[key], { get(target, name) { + // Detect access from React DevTools and ignore those. + const error = new Error(); + const accessFromDevTools = ['backend.js', 'dehydrate'] + .every((keyword) => error.stack && error.stack.includes(keyword)); + // Only care about the components defined in the plugins. - if (component.talkPluginName) { + if (component.talkPluginName && !accessFromDevTools) { const warning = `'${getDisplayName(component)}' of '${component.talkPluginName}' accessed '${key}.${name}' but did not define fragments using the withFragment HOC`; if (memoizedWarnings.indexOf(warning) === -1) { console.warn(warning);