From 5e4d010246c9606f62b6a42dc0f5bc0d51ffb26b Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 13 Mar 2018 20:43:06 +0100 Subject: [PATCH] Deprecate passing `data` prop to Slot --- .../coral-framework/hocs/withSlotElements.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/client/coral-framework/hocs/withSlotElements.js b/client/coral-framework/hocs/withSlotElements.js index 4580e7ce9..e02a9d5a7 100644 --- a/client/coral-framework/hocs/withSlotElements.js +++ b/client/coral-framework/hocs/withSlotElements.js @@ -106,6 +106,21 @@ const createHOC = ({ const slots = this.getSlots(props); const sizes = this.getSizes(props, slots.length); const defaultComponents = this.getSizes(props, slots.length); + const slotPassthrough = this.getPassthrough(props); + + if (process.env.NODE_ENV !== 'production') { + if (slotPassthrough.data && slotPassthrough.data.refetch) { + /* eslint-disable no-console */ + console.warn( + 'Slots no longer need `data` property.', + 'Plugins can use the new HOCs `withRefetch`,', + '`withFetchMore`, `withSubscribeToMore` and `withVariables` instead.', + 'Affected slots: ', + slots + ); + /* eslint-enable no-console */ + } + } const elements = []; slots.forEach((s, i) => { @@ -114,7 +129,7 @@ const createHOC = ({ const slotElements = plugins.getSlotElements( s, props.reduxState, - this.getPassthrough(props), + slotPassthrough, { size } ); @@ -122,7 +137,7 @@ const createHOC = ({ const p = plugins.getSlotComponentProps( DefaultComponent, props.reduxState, - this.getPassthrough(props) + slotPassthrough ); slotElements.push(); }