From 549363a76124aa88f9a9e97671323d01903fec8c Mon Sep 17 00:00:00 2001 From: Akira Sudoh Date: Thu, 25 Jan 2018 02:23:12 +0900 Subject: [PATCH] chore(OrderSummary): avoid redundant rendering upon auto-generating element IDs (#529) --- src/components/OrderSummary/OrderSummary.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/OrderSummary/OrderSummary.js b/src/components/OrderSummary/OrderSummary.js index f43cd4a6271c..b247af568853 100644 --- a/src/components/OrderSummary/OrderSummary.js +++ b/src/components/OrderSummary/OrderSummary.js @@ -37,9 +37,11 @@ export class OrderSummaryHeader extends Component { const { children, className, - id = `order__summary__header__id_${Math.random() - .toString(36) - .substr(2)}`, + id = (this._sectionId = + this._sectionId || + `order__summary__header__id_${Math.random() + .toString(36) + .substr(2)}`), title, ...other } = this.props; @@ -191,9 +193,11 @@ export class OrderSummaryFooter extends Component { render() { const { className, - id = `order__summary__footer__id_${Math.random() - .toString(36) - .substr(2)}`, + id = (this._sectionId = + this._sectionId || + `order__summary__footer__id_${Math.random() + .toString(36) + .substr(2)}`), footerText, linkText, href,