diff --git a/docs/src/modules/constants.js b/docs/src/modules/constants.js index 137e8f5efa3c96..8ba7cf480772eb 100644 --- a/docs/src/modules/constants.js +++ b/docs/src/modules/constants.js @@ -15,7 +15,7 @@ const LANGUAGES = ['en', 'zh', 'ru', 'pt', 'es', 'fr', 'de', 'ja', 'aa']; const LANGUAGES_SSR = ['en', 'zh', 'ru', 'pt', 'es']; // Work in progress -const LANGUAGES_IN_PROGRESS = [...LANGUAGES]; +const LANGUAGES_IN_PROGRESS = LANGUAGES.slice(); // Valid languages to use in production const LANGUAGES_LABEL = [ diff --git a/docs/src/pages/components/lists/CheckboxList.js b/docs/src/pages/components/lists/CheckboxList.js index 2ef8bb1811cd1e..7fa53292bb4eb8 100644 --- a/docs/src/pages/components/lists/CheckboxList.js +++ b/docs/src/pages/components/lists/CheckboxList.js @@ -23,7 +23,7 @@ export default function CheckboxList() { const handleToggle = (value) => () => { const currentIndex = checked.indexOf(value); - const newChecked = [...checked]; + const newChecked = checked.slice(); if (currentIndex === -1) { newChecked.push(value); diff --git a/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.js b/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.js index ec5b209a3d3d9d..e496b9a9fcd92b 100644 --- a/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.js +++ b/packages/material-ui-lab/src/ToggleButtonGroup/ToggleButtonGroup.js @@ -58,10 +58,10 @@ const ToggleButtonGroup = React.forwardRef(function ToggleButton(props, ref) { let newValue; if (value && index >= 0) { - newValue = [...value]; + newValue = value.slice(); newValue.splice(index, 1); } else { - newValue = value ? [...value, buttonValue] : [buttonValue]; + newValue = value ? value.concat(buttonValue) : [buttonValue]; } onChange(event, newValue); diff --git a/packages/material-ui-lab/src/TreeView/TreeView.js b/packages/material-ui-lab/src/TreeView/TreeView.js index 5cfa1211488b64..3518410dcc766a 100644 --- a/packages/material-ui-lab/src/TreeView/TreeView.js +++ b/packages/material-ui-lab/src/TreeView/TreeView.js @@ -217,7 +217,7 @@ const TreeView = React.forwardRef(function TreeView(props, ref) { const topLevelNodes = nodeMap.current[-1].children; diff = topLevelNodes.filter((node) => !isExpanded(node)); } - const newExpanded = [...expanded, ...diff]; + const newExpanded = expanded.concat(diff); if (diff.length > 0) { setExpandedState(newExpanded); diff --git a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js index 4f41fedd800c59..db79387aee6ef6 100644 --- a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js +++ b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js @@ -500,7 +500,7 @@ export default function useAutocomplete(props) { let newValue = option; if (multiple) { - newValue = Array.isArray(value) ? [...value] : []; + newValue = Array.isArray(value) ? value.slice() : []; if (process.env.NODE_ENV !== 'production') { const matches = newValue.filter((val) => getOptionSelected(option, val)); @@ -716,7 +716,7 @@ export default function useAutocomplete(props) { case 'Backspace': if (multiple && inputValue === '' && value.length > 0) { const index = focusedTag === -1 ? value.length - 1 : focusedTag; - const newValue = [...value]; + const newValue = value.slice(); newValue.splice(index, 1); handleValue(event, newValue, 'remove-option', { option: value[index], @@ -805,7 +805,7 @@ export default function useAutocomplete(props) { }; const handleTagDelete = (index) => (event) => { - const newValue = [...value]; + const newValue = value.slice(); newValue.splice(index, 1); handleValue(event, newValue, 'remove-option', { option: value[index], diff --git a/packages/material-ui/src/MobileStepper/MobileStepper.js b/packages/material-ui/src/MobileStepper/MobileStepper.js index b9a8f7a5b28cd1..4ea392ea9a7d73 100644 --- a/packages/material-ui/src/MobileStepper/MobileStepper.js +++ b/packages/material-ui/src/MobileStepper/MobileStepper.js @@ -88,7 +88,7 @@ const MobileStepper = React.forwardRef(function MobileStepper(props, ref) { {variant === 'dots' && (