Skip to content

Commit

Permalink
Remove UNSAFE_componentWillUpdate from QuillEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
maiwald committed Oct 4, 2024
1 parent 972be70 commit 3e6eb90
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions app/packs/src/components/QuillEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,14 @@ export default class QuillEditor extends React.Component {
}
}

// eslint-disable-next-line camelcase
UNSAFE_componentWillUpdate() {
this.componentWillUnmount();
}

componentDidUpdate() {
this.componentDidMount();
}

componentWillUnmount() {
// Don't set the state to null, it would generate a loop.
componentDidUpdate(prevProps) {
const { value } = this.props;
if (value?.ops === prevProps.value?.ops) return;

this.setState({ value });
const sel = this.editor.getSelection();
this.editor.setContents(value);
if (sel) this.editor.setSelection(sel);
}

onChange(val) {
Expand Down

0 comments on commit 3e6eb90

Please sign in to comment.