Skip to content

Commit f572e46

Browse files
kivloroliviertassinari
authored andcommitted
[theme] Use isPlainObject to avoid dropping prototypes (#12100)
* use isPlainObject with deepclone to avoid droping prototypes * revert yarn.lock * missing newline * increase size-limit
1 parent 8e4b252 commit f572e46

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

.size-limit.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ module.exports = [
2121
name: 'The initial cost people pay for using one component',
2222
webpack: true,
2323
path: 'packages/material-ui/build/Paper/index.js',
24-
limit: '17.6 KB',
24+
limit: '17.8 KB',
2525
},
2626
{
2727
name: 'The size of all the modules of material-ui.',
2828
webpack: true,
2929
path: 'packages/material-ui/build/index.js',
30-
limit: '94.3 KB',
30+
limit: '94.5 KB',
3131
},
3232
{
3333
name: 'The main bundle of the docs',

packages/material-ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"deepmerge": "^2.0.1",
4545
"dom-helpers": "^3.2.1",
4646
"hoist-non-react-statics": "^2.5.0",
47+
"is-plain-object": "^2.0.4",
4748
"jss": "^9.3.3",
4849
"jss-camel-case": "^6.0.0",
4950
"jss-default-unit": "^8.0.2",

packages/material-ui/src/styles/createMuiTheme.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @flow
22

33
import deepmerge from 'deepmerge'; // < 1kb payload overhead when lodash/merge is > 3kb.
4+
import isPlainObject from 'is-plain-object';
45
import warning from 'warning';
56
import createBreakpoints from './createBreakpoints';
67
import createMixins from './createMixins';
@@ -42,6 +43,9 @@ function createMuiTheme(options: Object = {}) {
4243
zIndex,
4344
},
4445
other,
46+
{
47+
isMergeableObject: isPlainObject,
48+
},
4549
),
4650
};
4751

packages/material-ui/src/styles/createMuiTheme.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ describe('createMuiTheme', () => {
7777
MuiButtonBase: {
7878
disableRipple: true,
7979
},
80+
MuiPopover: {
81+
container: document.createElement('div'),
82+
},
8083
};
8184
const muiTheme = createMuiTheme({ props });
8285
assert.deepEqual(muiTheme.props, props);

0 commit comments

Comments
 (0)