diff --git a/plugin-api/beta/client/hocs/withReaction.js b/plugin-api/beta/client/hocs/withReaction.js index f7be6e701..40ee6e14c 100644 --- a/plugin-api/beta/client/hocs/withReaction.js +++ b/plugin-api/beta/client/hocs/withReaction.js @@ -54,6 +54,13 @@ export default (reaction) => (WrappedComponent) => { id: fragmentId }); + if (!data) { + if (self) { + throw new Error(`Comment ${action.item_id} was not found`); + } + return; + } + // Add our comment from the mutation to the end. let idx = data.action_summaries.findIndex(isReaction); @@ -96,6 +103,13 @@ export default (reaction) => (WrappedComponent) => { id: fragmentId }); + if (!data) { + if (self) { + throw new Error(`Comment ${action.item_id} was not found`); + } + return; + } + // Check whether we liked this comment. const idx = data.action_summaries.findIndex(isReaction);