Commit e8723bea authored by Flavio TARSETTI's avatar Flavio TARSETTI

Merge branch 'tc-modal-refresh-fix' into 'master'

Fix state refreshing block editor modal when changing block name

Closes #146

See merge request !13
parents 53b89cd6 74b0dff8
Pipeline #22999 passed with stages
in 57 minutes and 44 seconds
...@@ -59,7 +59,7 @@ type Props = { ...@@ -59,7 +59,7 @@ type Props = {
type State = { type State = {
}; };
class ToolchainModal extends React.PureComponent<Props, State> { class ToolchainModal extends React.Component<Props, State> {
constructor(props: Props){ constructor(props: Props){
super(props); super(props);
} }
...@@ -67,6 +67,14 @@ class ToolchainModal extends React.PureComponent<Props, State> { ...@@ -67,6 +67,14 @@ class ToolchainModal extends React.PureComponent<Props, State> {
state = { state = {
} }
shouldComponentUpdate(nextProps: Props){
if(nextProps.active !== this.props.active)
return true;
if(nextProps.data !== undefined && nextProps.data !== this.props.data)
return true;
return false;
}
render = () => { render = () => {
const data = this.props.data; const data = this.props.data;
if(!data) if(!data)
...@@ -229,7 +237,10 @@ class ToolchainModal extends React.PureComponent<Props, State> { ...@@ -229,7 +237,10 @@ class ToolchainModal extends React.PureComponent<Props, State> {
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button block color='danger' <Button block color='danger'
onClick={this.props.deleteBlock} onClick={(e) => {
this.props.deleteBlock();
this.props.toggle();
}}
> >
Delete Block Delete Block
</Button> </Button>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment