Skip to content
Snippets Groups Projects
Commit 74b0dff8 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[js][tc] fix state refreshing modal when changing block name, closes #146

parent 53b89cd6
No related branches found
No related tags found
1 merge request!13Fix state refreshing block editor modal when changing block name
Pipeline #
...@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment