From 743b409f7f6d8b8c5de9d9fd99f16fff65475f42 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 9 Jun 2021 12:08:41 +0200 Subject: [PATCH] fix some react deprecation warnings --- web/src/js/__tests__/components/helpers/AutoScrollSpec.js | 4 ++-- web/src/js/components/Header/FilterDocs.jsx | 2 +- web/src/js/components/Header/FilterInput.jsx | 4 ++-- web/src/js/components/helpers/AutoScroll.js | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/web/src/js/__tests__/components/helpers/AutoScrollSpec.js b/web/src/js/__tests__/components/helpers/AutoScrollSpec.js index 18a3d669e..84d1d3007 100644 --- a/web/src/js/__tests__/components/helpers/AutoScrollSpec.js +++ b/web/src/js/__tests__/components/helpers/AutoScrollSpec.js @@ -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 }) diff --git a/web/src/js/components/Header/FilterDocs.jsx b/web/src/js/components/Header/FilterDocs.jsx index 198c01170..d036b6ecc 100644 --- a/web/src/js/components/Header/FilterDocs.jsx +++ b/web/src/js/components/Header/FilterDocs.jsx @@ -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(() => { diff --git a/web/src/js/components/Header/FilterInput.jsx b/web/src/js/components/Header/FilterInput.jsx index 44496d5bf..151036109 100644 --- a/web/src/js/components/Header/FilterInput.jsx +++ b/web/src/js/components/Header/FilterInput.jsx @@ -106,7 +106,7 @@ export default class FilterInput extends Component { return (
- + -
+
{this.getDesc()}
diff --git a/web/src/js/components/helpers/AutoScroll.js b/web/src/js/components/helpers/AutoScroll.js index 403db95fa..1d4d90c58 100644 --- a/web/src/js/components/helpers/AutoScroll.js +++ b/web/src/js/components/helpers/AutoScroll.js @@ -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(); }