From cce861fe420c4060b1f52982ca6920611d8b2809 Mon Sep 17 00:00:00 2001 From: Ilya Semenov Date: Wed, 10 Oct 2018 21:04:40 +0700 Subject: [PATCH] fix: don't inject initialDataKey to object decomposition This is a fix for babel plugin addInitialDataKey. Fixes #119. --- lib/babel/addInitialDataKey.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/babel/addInitialDataKey.js b/lib/babel/addInitialDataKey.js index a5fb9f6..b7637c1 100644 --- a/lib/babel/addInitialDataKey.js +++ b/lib/babel/addInitialDataKey.js @@ -19,6 +19,7 @@ module.exports = ({ types: t }) => ({ ) { if ( path.node.key.name !== 'getInitialData' || + path.parentPath.isObjectPattern() || hasDataKey(path.parent.properties) ) { return