Skip to content

Commit

Permalink
[theme] Use isPlainObject to avoid dropping prototypes (mui#12100)
Browse files Browse the repository at this point in the history
* use isPlainObject with deepclone to avoid droping prototypes

* revert yarn.lock

* missing newline

* increase size-limit
  • Loading branch information
kivlor authored and Joe Shelby committed Jul 14, 2018
1 parent abb9797 commit 18d0cbe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ module.exports = [
name: 'The initial cost people pay for using one component',
webpack: true,
path: 'packages/material-ui/build/Paper/index.js',
limit: '17.6 KB',
limit: '17.8 KB',
},
{
name: 'The size of all the modules of material-ui.',
webpack: true,
path: 'packages/material-ui/build/index.js',
limit: '94.3 KB',
limit: '94.5 KB',
},
{
name: 'The main bundle of the docs',
Expand Down
1 change: 1 addition & 0 deletions packages/material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"deepmerge": "^2.0.1",
"dom-helpers": "^3.2.1",
"hoist-non-react-statics": "^2.5.0",
"is-plain-object": "^2.0.4",
"jss": "^9.3.3",
"jss-camel-case": "^6.0.0",
"jss-default-unit": "^8.0.2",
Expand Down
4 changes: 4 additions & 0 deletions packages/material-ui/src/styles/createMuiTheme.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow

import deepmerge from 'deepmerge'; // < 1kb payload overhead when lodash/merge is > 3kb.
import isPlainObject from 'is-plain-object';
import warning from 'warning';
import createBreakpoints from './createBreakpoints';
import createMixins from './createMixins';
Expand Down Expand Up @@ -42,6 +43,9 @@ function createMuiTheme(options: Object = {}) {
zIndex,
},
other,
{
isMergeableObject: isPlainObject,
},
),
};

Expand Down
3 changes: 3 additions & 0 deletions packages/material-ui/src/styles/createMuiTheme.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ describe('createMuiTheme', () => {
MuiButtonBase: {
disableRipple: true,
},
MuiPopover: {
container: document.createElement('div'),
},
};
const muiTheme = createMuiTheme({ props });
assert.deepEqual(muiTheme.props, props);
Expand Down

0 comments on commit 18d0cbe

Please sign in to comment.