Skip to content

Commit

Permalink
fix: Well Log Viewer - Moved callback subscription to well-log-viewer…
Browse files Browse the repository at this point in the history
… mounted hook (#2217)

Resolves issue #2216 

The callback manager events introduced in PR #2196 where being set up in
the _constructor_ hook, not in the `componentDidMount()` hook, which is
against React guidelines.

This PR fixes that
  • Loading branch information
Anders2303 authored Sep 3, 2024
1 parent fd2feeb commit c0e5c97
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions typescript/packages/well-log-viewer/src/WellLogViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,6 @@ export default class WellLogViewer extends Component<
this.onInfoGroupClick = this.onInfoGroupClick.bind(this);

this.onChangePrimaryAxis = this.onChangePrimaryAxis.bind(this);

this.callbackManager.registerCallback(
"onInfoGroupClick",
this.onInfoGroupClick,
true
);

if (props.onInfoFilled) {
this.callbackManager.registerCallback(
"onInfoFilled",
props.onInfoFilled
);
}
}

onInfoGroupClick(info: Info): void {
Expand Down Expand Up @@ -192,6 +179,19 @@ export default class WellLogViewer extends Component<
}

componentDidMount(): void {
this.callbackManager.registerCallback(
"onInfoGroupClick",
this.onInfoGroupClick,
true
);

if (this.props.onInfoFilled) {
this.callbackManager.registerCallback(
"onInfoFilled",
this.props.onInfoFilled
);
}

this.onContentRescale();
const controller = this.callbackManager?.controller;
if (controller) {
Expand Down

0 comments on commit c0e5c97

Please sign in to comment.