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 = {
type State = {
};
class ToolchainModal extends React.PureComponent<Props, State> {
class ToolchainModal extends React.Component<Props, State> {
constructor(props: Props){
super(props);
}
......@@ -67,6 +67,14 @@ class ToolchainModal extends React.PureComponent<Props, 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 = () => {
const data = this.props.data;
if(!data)
......@@ -229,7 +237,10 @@ class ToolchainModal extends React.PureComponent<Props, State> {
</ModalBody>
<ModalFooter>
<Button block color='danger'
onClick={this.props.deleteBlock}
onClick={(e) => {
this.props.deleteBlock();
this.props.toggle();
}}
>
Delete Block
</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