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() } this.state = { vScroll: calcVScroll() }
} }
componentWillUpdate() { UNSAFE_componentWillUpdate() {
mockFn("foo") mockFn("foo")
} }
@ -31,7 +31,7 @@ describe('Autoscroll', () => {
viewport = ReactDOM.findDOMNode(autoScroll) viewport = ReactDOM.findDOMNode(autoScroll)
viewport.scrollTop = 10 viewport.scrollTop = 10
Object.defineProperty(viewport, "scrollHeight", { value: 10, writable: true }) Object.defineProperty(viewport, "scrollHeight", { value: 10, writable: true })
autoScroll.componentWillUpdate() autoScroll.UNSAFE_componentWillUpdate()
expect(mockFn).toBeCalledWith("foo") expect(mockFn).toBeCalledWith("foo")
Object.defineProperty(viewport, "scrollHeight", { value: 0, writable: true }) 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 } this.state = { doc: FilterDocs.doc }
} }
componentWillMount() { componentDidMount() {
if (!FilterDocs.xhr) { if (!FilterDocs.xhr) {
FilterDocs.xhr = fetchApi('/filter-help').then(response => response.json()) FilterDocs.xhr = fetchApi('/filter-help').then(response => response.json())
FilterDocs.xhr.catch(() => { FilterDocs.xhr.catch(() => {

View File

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

View File

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