Bugfix
This commit is contained in:
parent
1cde3d866d
commit
31a2d13cdb
|
@ -7,8 +7,9 @@ export default class DOMWidget extends Component {
|
|||
this.element = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
componentWillReceiveProps(next) {
|
||||
if (this.element.current) {
|
||||
if (this.props.annotation !== next.annotation) {
|
||||
const widgetEl = this.props.widget({
|
||||
annotation: this.props.annotation,
|
||||
readOnly: this.props.readOnly,
|
||||
|
@ -18,9 +19,14 @@ export default class DOMWidget extends Component {
|
|||
onSaveAndClose: () => this.props.onSaveAndClose()
|
||||
});
|
||||
|
||||
// Delete previous rendered state
|
||||
while (this.element.current.firstChild)
|
||||
this.element.current.removeChild(this.element.current.lastChild);
|
||||
|
||||
this.element.current.appendChild(widgetEl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue