From 6b37eee2321041c5311cc002639f8286849b178c Mon Sep 17 00:00:00 2001 From: Abhas Date: Wed, 26 Dec 2018 11:36:35 +0530 Subject: [PATCH] Show wrong code - Props check using if else This will break when props updates are batched, say from onclick event (like the last button here) --- src/components/SectionManager/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/SectionManager/index.js b/src/components/SectionManager/index.js index 949d830..caf2bf6 100644 --- a/src/components/SectionManager/index.js +++ b/src/components/SectionManager/index.js @@ -26,9 +26,7 @@ export default class SectionManager extends Component { if (scrollProps.sectionName !== oldScrollProps.sectionName) { this.scrollToSection(scrollProps.sectionName) - } - - if (postProps.postNumber !== oldPostProps.postNumber) { + } else if (postProps.postNumber !== oldPostProps.postNumber) { this.updateSectionBody(postProps.postNumber); } }