From 4fe0df5b4dfbe161cf1ad8bb5183c61506b556b6 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 22 Jul 2021 09:58:12 +0200 Subject: [PATCH] =?UTF-8?q?[AccordionSummary]=20Fix=20false-positive=20pro?= =?UTF-8?q?pType=20warning=20with=20`disableG=E2=80=A6=20(#27385)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/material-ui/src/AccordionSummary/AccordionSummary.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/material-ui/src/AccordionSummary/AccordionSummary.js b/packages/material-ui/src/AccordionSummary/AccordionSummary.js index d2f730e8610835..8571e2ad90803b 100644 --- a/packages/material-ui/src/AccordionSummary/AccordionSummary.js +++ b/packages/material-ui/src/AccordionSummary/AccordionSummary.js @@ -144,7 +144,9 @@ AccordionSummary.propTypes = { * See [CSS API](#css) below for more details. */ classes: chainPropTypes(PropTypes.object, (props) => { - if (props.classes.focused.indexOf(' ') !== -1) { + // Guard against when generation of classes is disabled in the stylesheets (`disableGeneration`). + // For `disableGeneration` we don't have an accurate warning but `disableGeneration` is an advanced use case anyway. + if (props.classes.focused !== undefined && props.classes.focused.indexOf(' ') !== -1) { return new Error( [ 'Material-UI: The `classes.focused` key is deprecated.',