diff --git a/packages/libs/wdk-client/src/Components/AttributeFilter/FieldList.jsx b/packages/libs/wdk-client/src/Components/AttributeFilter/FieldList.jsx
index a1e1fac7df..3dae2bf6eb 100644
--- a/packages/libs/wdk-client/src/Components/AttributeFilter/FieldList.jsx
+++ b/packages/libs/wdk-client/src/Components/AttributeFilter/FieldList.jsx
@@ -1,7 +1,6 @@
import { memoize, uniq } from 'lodash';
import PropTypes from 'prop-types';
import React, { useLayoutEffect, useRef } from 'react';
-import ReactDOM from 'react-dom';
import { scrollIntoViewIfNeeded } from '../../Utils/DomUtils';
import { Seq } from '../../Utils/IterableUtils';
import { areTermsInString, makeSearchHelpText } from '../../Utils/SearchUtils';
@@ -64,8 +63,8 @@ export default class FieldList extends React.Component {
}
}
- handleCheckboxTreeRef(component) {
- this.treeDomNode = ReactDOM.findDOMNode(component);
+ handleCheckboxTreeRef(node) {
+ this.treeDomNode = node;
}
handleExpansionChange(expandedNodes) {
diff --git a/packages/libs/wdk-client/src/Components/AttributeFilter/Histogram.jsx b/packages/libs/wdk-client/src/Components/AttributeFilter/Histogram.jsx
index f42ff49a9a..b8ecea0b53 100644
--- a/packages/libs/wdk-client/src/Components/AttributeFilter/Histogram.jsx
+++ b/packages/libs/wdk-client/src/Components/AttributeFilter/Histogram.jsx
@@ -12,7 +12,6 @@ import {
} from 'lodash';
import PropTypes from 'prop-types';
import React from 'react';
-import ReactDOM from 'react-dom';
import { lazy } from '../../Utils/ComponentUtils';
import { Seq } from '../../Utils/IterableUtils';
import DateRangeSelector from '../../Components/InputControls/DateRangeSelector';
@@ -68,6 +67,7 @@ var Histogram = (function () {
super(props);
this.handleResize = throttle(this.handleResize.bind(this), 100);
this.emitStateChange = debounce(this.emitStateChange, 100);
+ this.containerRef = React.createRef();
this.state = {
uiState: this.getStateFromProps(props),
showSettings:
@@ -80,7 +80,7 @@ var Histogram = (function () {
componentDidMount() {
$(window).on('resize', this.handleResize);
- $(ReactDOM.findDOMNode(this))
+ $(this.containerRef.current)
.on('plotselected .chart', this.handlePlotSelected.bind(this))
.on('plotselecting .chart', this.handlePlotSelecting.bind(this))
.on('plotunselected .chart', this.handlePlotUnselected.bind(this))
@@ -416,7 +416,7 @@ var Histogram = (function () {
if (this.plot) this.plot.destroy();
- this.$chart = $(ReactDOM.findDOMNode(this)).find('.chart');
+ this.$chart = $(this.containerRef.current).find('.chart');
this.plot = $.plot(this.$chart, seriesData, plotOptions);
}
@@ -656,7 +656,7 @@ var Histogram = (function () {
);
return (
-
+
{yaxisLabel}
diff --git a/packages/libs/wdk-client/src/Components/Display/Sticky.jsx b/packages/libs/wdk-client/src/Components/Display/Sticky.jsx
index c8a93392e1..a63946956a 100644
--- a/packages/libs/wdk-client/src/Components/Display/Sticky.jsx
+++ b/packages/libs/wdk-client/src/Components/Display/Sticky.jsx
@@ -1,16 +1,16 @@
import React from 'react';
-import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
class Sticky extends React.Component {
constructor(props) {
super(props);
this.updateIsFixed = this.updateIsFixed.bind(this);
+ this.containerRef = React.createRef();
this.state = { isFixed: false, height: null, width: null };
}
componentDidMount() {
- this.node = ReactDOM.findDOMNode(this);
+ this.node = this.containerRef.current;
window.addEventListener('scroll', this.updateIsFixed, { passive: true });
window.addEventListener('wheel', this.updateIsFixed, { passive: true });
window.addEventListener('resize', this.updateIsFixed, { passive: true });
@@ -47,7 +47,7 @@ class Sticky extends React.Component {
render() {
return (
// This node is used to track scroll position
-
+
{this.props.children(this.state)}
);
diff --git a/packages/libs/wdk-client/src/Components/InputControls/IndeterminateCheckbox.tsx b/packages/libs/wdk-client/src/Components/InputControls/IndeterminateCheckbox.tsx
index 959bdd8e75..90450bc95d 100644
--- a/packages/libs/wdk-client/src/Components/InputControls/IndeterminateCheckbox.tsx
+++ b/packages/libs/wdk-client/src/Components/InputControls/IndeterminateCheckbox.tsx
@@ -1,4 +1,3 @@
-import ReactDOM from 'react-dom';
import React from 'react';
import FormEvent = React.FormEvent;
@@ -18,6 +17,8 @@ export type IndeterminateCheckboxProps
= {
export default class IndeterminateCheckbox extends React.Component<
IndeterminateCheckboxProps
> {
+ private inputRef = React.createRef();
+
constructor(props: IndeterminateCheckboxProps) {
super(props);
@@ -39,8 +40,10 @@ export default class IndeterminateCheckbox extends React.Component<
* @param indeterminate
*/
setIndeterminate(indeterminate: boolean) {
- const node = ReactDOM.findDOMNode(this) as HTMLInputElement;
- node.indeterminate = indeterminate;
+ const node = this.inputRef.current;
+ if (node) {
+ node.indeterminate = indeterminate;
+ }
}
handleChange(e: FormEvent) {
@@ -53,6 +56,7 @@ export default class IndeterminateCheckbox extends React.Component<
let nameProp = this.props.name ? { name: this.props.name } : {};
return (
{
private spinner?: Spinner;
+ private containerRef = React.createRef();
componentDidMount() {
const { radius = 8, top = '50%', left = '50%' } = this.props;
@@ -52,8 +52,10 @@ class Loading extends React.Component {
top, // Top position relative to parent
left, // Left position relative to parent
};
- const node = findDOMNode(this) as HTMLElement;
- this.spinner = new Spinner(opts).spin(node);
+ const node = this.containerRef.current;
+ if (node) {
+ this.spinner = new Spinner(opts).spin(node);
+ }
}
componentWillUnmount() {
@@ -63,7 +65,7 @@ class Loading extends React.Component {
render() {
const { className = '', style } = this.props;
return (
-
+
{this.props.children}
);
diff --git a/packages/libs/wdk-client/src/Components/Overlays/Popup.tsx b/packages/libs/wdk-client/src/Components/Overlays/Popup.tsx
index 3fed057c54..f5afd9f3ab 100644
--- a/packages/libs/wdk-client/src/Components/Overlays/Popup.tsx
+++ b/packages/libs/wdk-client/src/Components/Overlays/Popup.tsx
@@ -186,8 +186,9 @@ class Popup extends React.Component
{
render() {
const children = React.cloneElement(this.props.children, {
- ref: (c: React.ReactInstance | null) =>
- (this.popupNode = c && (ReactDOM.findDOMNode(c) as HTMLElement)),
+ ref: (node: HTMLElement | null) => {
+ this.popupNode = node;
+ },
});
const content = (
diff --git a/packages/libs/wdk-client/src/Controllers/LegacyParamController.tsx b/packages/libs/wdk-client/src/Controllers/LegacyParamController.tsx
index ccc8724669..9287ded006 100644
--- a/packages/libs/wdk-client/src/Controllers/LegacyParamController.tsx
+++ b/packages/libs/wdk-client/src/Controllers/LegacyParamController.tsx
@@ -1,6 +1,5 @@
import { debounce, get } from 'lodash';
import React from 'react';
-import ReactDOM from 'react-dom';
import {
updateActiveQuestion,
@@ -48,6 +47,7 @@ class LegacyParamController extends ViewController {
static readonly PARAM_INVALID_EVENT = 'param-invalid';
paramModules = ParamModules;
+ private containerRef = React.createRef();
componentWillUnmount() {
const { searchName } = this.props.own;
@@ -93,7 +93,7 @@ class LegacyParamController extends ViewController {
});
}
- const node = ReactDOM.findDOMNode(this);
+ const node = this.containerRef.current;
// Trigger event in case of question error
if (
@@ -165,16 +165,17 @@ class LegacyParamController extends ViewController {
: '');
return (
-
+
{errorMessage}
{isProbablyRevise && [
-
+
Current value:
,
@@ -197,7 +198,7 @@ class LegacyParamController extends ViewController {
if (this.props.mapped.paramErrors[parameter.name]) {
return (
-