From ce8bdd04d0b5bd1f34c10a03db0066eeb623e83b Mon Sep 17 00:00:00 2001 From: Nitzan Raz Date: Tue, 13 Aug 2019 01:55:29 -0700 Subject: [PATCH] Composer: Not assuming element has leaves Summary: Fixes a bug that where two dates are mentioned in a row, the second date doesn't have leaf elements (not sure what those are) and explodes. Instead, the second date just won't be highlighted This affects more than just dates, as one can see in the attached task. Reviewed By: claudiopro Differential Revision: D16756786 fbshipit-source-id: 929600e1a5258120c70f2321eeace651afee3670 --- src/component/contents/DraftEditorBlock.react.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/component/contents/DraftEditorBlock.react.js b/src/component/contents/DraftEditorBlock.react.js index 862ecc4caa..8d98d1683e 100644 --- a/src/component/contents/DraftEditorBlock.react.js +++ b/src/component/contents/DraftEditorBlock.react.js @@ -147,6 +147,10 @@ class DraftEditorBlock extends React.Component { return this.props.tree .map((leafSet, ii) => { const leavesForLeafSet = leafSet.get('leaves'); + // T44088704 + if (leavesForLeafSet.size === 0) { + return null; + } const lastLeaf = leavesForLeafSet.size - 1; const leaves = leavesForLeafSet .map((leaf, jj) => {