This repository was archived by the owner on Apr 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Possibility of Bug on passing settings #7
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
In these lines, there is a possibility of existing of a bug:
~~~
const {
classes,
settings,
children,
anchorOriginVertical,
anchorOriginHorizontal,
} = this.props;
return (
<Provider value={this.getChildrenContext()}>
{children}
<NoSsr>
<Snackbar
anchorOrigin={{
vertical: anchorOriginVertical,
horizontal: anchorOriginHorizontal,
}}
open={open}
onClose={this.handleClose}
{...settings}
>
~~~
The spreading of setting can overwrite the open or onClose props. we should have codes like below to avoid this possibility of the bug:
~~~
const {
classes,
settings: {
open: _open,
onClose: _onClose,
...restOfSettings
},
children,
anchorOriginVertical,
anchorOriginHorizontal,
} = this.props;
return (
<Provider value={this.getChildrenContext()}>
{children}
<NoSsr>
<Snackbar
anchorOrigin={{
vertical: anchorOriginVertical,
horizontal: anchorOriginHorizontal,
}}
open={open}
onClose={this.handleClose}
{...restOfSettings}
>
~~~
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request