fix some react deprecation warnings

This commit is contained in:
Maximilian Hils 2021-06-09 12:08:41 +02:00
parent d3f33b90a6
commit 743b409f7f
4 changed files with 6 additions and 5 deletions

View File

@ -12,7 +12,7 @@ describe('Autoscroll', () => {
this.state = { vScroll: calcVScroll() }
}
componentWillUpdate() {
UNSAFE_componentWillUpdate() {
mockFn("foo")
}
@ -31,7 +31,7 @@ describe('Autoscroll', () => {
viewport = ReactDOM.findDOMNode(autoScroll)
viewport.scrollTop = 10
Object.defineProperty(viewport, "scrollHeight", { value: 10, writable: true })
autoScroll.componentWillUpdate()
autoScroll.UNSAFE_componentWillUpdate()
expect(mockFn).toBeCalledWith("foo")
Object.defineProperty(viewport, "scrollHeight", { value: 0, writable: true })

View File

@ -14,7 +14,7 @@ export default class FilterDocs extends Component {
this.state = { doc: FilterDocs.doc }
}
componentWillMount() {
componentDidMount() {
if (!FilterDocs.xhr) {
FilterDocs.xhr = fetchApi('/filter-help').then(response => response.json())
FilterDocs.xhr.catch(() => {

View File

@ -106,7 +106,7 @@ export default class FilterInput extends Component {
return (
<div className={classnames('filter-input input-group', { 'has-error': !this.isValid() })}>
<span className="input-group-addon">
<i className={'fa fa-fw fa-' + type} style={{ color }}></i>
<i className={'fa fa-fw fa-' + type} style={{ color }}/>
</span>
<input
type="text"
@ -123,7 +123,7 @@ export default class FilterInput extends Component {
<div className="popover bottom"
onMouseEnter={this.onMouseEnter}
onMouseLeave={this.onMouseLeave}>
<div className="arrow"></div>
<div className="arrow"/>
<div className="popover-content">
{this.getDesc()}
</div>

View File

@ -11,6 +11,7 @@ export default Component => Object.assign(class AutoScrollWrapper extends Compon
UNSAFE_componentWillUpdate() {
const viewport = ReactDOM.findDOMNode(this);
this[symShouldStick] = viewport.scrollTop && isAtBottom(viewport);
super.UNSAFE_componentWillUpdate && super.UNSAFE_componentWillUpdate();
super.componentWillUpdate && super.componentWillUpdate();
}