Skip to content

Commit

Permalink
#1995 deprecation findDOMNode in React.StrictMode prevents edit (#1996)
Browse files Browse the repository at this point in the history
Signed-off-by: CTomlyn <[email protected]>
  • Loading branch information
tomlyn authored May 29, 2024
1 parent 1a3d88e commit f7c9184
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class CanvasContents extends React.Component {
this.dragX = null;
this.dragY = null;

// Reference for the contents <div>
this.contentsRef = React.createRef();

// Record whether we added the event listeners or not.
this.eventListenersAdded = false;

Expand Down Expand Up @@ -575,9 +578,10 @@ class CanvasContents extends React.Component {

return (
<main aria-label={this.getLabel("canvas.label")} role="main">
<ReactResizeDetector handleWidth handleHeight onResize={this.refreshOnSizeChange}>
<ReactResizeDetector handleWidth handleHeight onResize={this.refreshOnSizeChange} targetRef={this.contentsRef}>
<div
id={this.mainCanvasDivId}
ref={this.contentsRef}
className="common-canvas-drop-div"
onDrop={this.drop}
onDragOver={this.dragOver}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class FlexibleTable extends React.Component {
this.rowHeight = this.rowHeight.bind(this);
this.rowGetter = this.rowGetter.bind(this);

this.tableRef = React.createRef();

this.getOriginalRowIndex = this.getOriginalRowIndex.bind(this);
this.getLastChildPropertyIdRow = this.getLastChildPropertyIdRow.bind(this);

Expand Down Expand Up @@ -557,8 +559,11 @@ class FlexibleTable extends React.Component {
<div data-id={"properties-ft-" + this.props.scrollKey} className={ftClassname} ref={ (ref) => (this.flexibleTable = ref) }>
{ftHeader}
<div className="properties-ft-container-panel">
<ReactResizeDetector handleWidth onResize={this._updateTableWidth}>
<div className={classNames("properties-ft-container-wrapper", this.props.messageInfo ? this.props.messageInfo.type : "")} style={ heightStyle }>
<ReactResizeDetector handleWidth onResize={this._updateTableWidth} targetRef={this.tableRef}>
<div className={classNames("properties-ft-container-wrapper", this.props.messageInfo ? this.props.messageInfo.type : "")}
style={ heightStyle }
ref={this.tableRef}
>
<div className={messageClass}>
<VirtualizedTable
tableLabel={this.props.tableLabel}
Expand Down
2 changes: 1 addition & 1 deletion canvas_modules/common-canvas/src/toolbar/toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ class Toolbar extends React.Component {
const tabIndex = this.state.focusAction === "toolbar" ? 0 : -1;

const canvasToolbar = (
<ReactResizeDetector handleWidth onResize={this.onToolbarResize}>
<ReactResizeDetector handleWidth onResize={this.onToolbarResize} targetRef={this.toolbarRef}>
<div ref={this.toolbarRef} className={toolbarSizeClass} instanceid={this.props.instanceId}
tabIndex={tabIndex} onFocus={this.onFocus} onBlur={this.onBlur} onKeyDown={this.onKeyDown}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export default class SidePanelForms extends React.Component {
this.tipConfigChange = this.tipConfigChange.bind(this);
this.onDragStart = this.onDragStart.bind(this);
}
// should be changed to componentDidMount but causes FVT tests to fail
UNSAFE_componentWillMount() { // eslint-disable-line camelcase, react/sort-comp

componentDidMount() { // eslint-disable-line camelcase, react/sort-comp
const that = this;

FormsService.getFiles("diagrams")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export default class SidePanelProperties extends React.Component {
applyPropertyChanges: this.applyPropertyChanges
};
}
// should be changed to componentDidMount but causes FVT tests to fail
UNSAFE_componentWillMount() { // eslint-disable-line camelcase, react/sort-comp

componentDidMount() { // eslint-disable-line camelcase, react/sort-comp
const that = this;
FormsService.getFiles(FORMS)
.then(function(res) {
Expand Down

0 comments on commit f7c9184

Please sign in to comment.