From cf84727ce7f8fb1a3215f645869d3a8ea7c37fca Mon Sep 17 00:00:00 2001 From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr> Date: Tue, 9 Jan 2024 10:23:12 +0100 Subject: [PATCH] Clean code after fixing ref forwarding --- src/components/CanvasAnnotations.js | 6 ------ src/components/ScrollTo.js | 2 +- src/containers/CanvasAnnotations.js | 9 ++++++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/CanvasAnnotations.js b/src/components/CanvasAnnotations.js index 46ea83a18..c0867e981 100644 --- a/src/components/CanvasAnnotations.js +++ b/src/components/CanvasAnnotations.js @@ -108,12 +108,6 @@ export class CanvasAnnotations extends Component { const annotationCount = annotations.length; - console.log('CanvasAnnotations containerRef : ', containerRef); - - if (!containerRef.current) { - return <div>containerRef is null</div>; - } - return ( <> <Typography sx={{ paddingLeft: 2, paddingRight: 1, paddingTop: 2 }} variant="overline"> diff --git a/src/components/ScrollTo.js b/src/components/ScrollTo.js index cb5856953..bd36a272f 100644 --- a/src/components/ScrollTo.js +++ b/src/components/ScrollTo.js @@ -15,7 +15,7 @@ export class ScrollTo extends Component { /** */ componentDidMount() { - const { scrollTo, containerRef } = this.props; + const { scrollTo } = this.props; if (!scrollTo) return; this.scrollToElement(); diff --git a/src/containers/CanvasAnnotations.js b/src/containers/CanvasAnnotations.js index b8d4c8b7e..613c2d3a7 100644 --- a/src/containers/CanvasAnnotations.js +++ b/src/containers/CanvasAnnotations.js @@ -51,10 +51,17 @@ const mapDispatchToProps = { selectAnnotation: actions.selectAnnotation, }; +// const enhance = compose( +// withRef(), +// withTranslation(), +// connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true }), +// withPlugins('CanvasAnnotations'), +// ); + const enhance = compose( withRef(), withTranslation(), - connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true }), + connect(mapStateToProps, mapDispatchToProps), withPlugins('CanvasAnnotations'), ); -- GitLab