Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"headroom.js": "^0.11.0",
"luxon": "^1.25.0",
"prop-types": "^15.7.2",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-hook-form": "^6.8.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-hook-form": "^6.11.0",
"react-hooks-global-state": "^1.0.1",
"react-router": "5.1.2",
"react-router-dom": "5.1.2",
"react-scripts": "3.4.0",
"react-waypoint": "^9.0.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.0",
"react-waypoint": "^9.0.3",
"reactstrap": "^8.7.1",
"rxjs": "^6.6.3",
"yarn": "^1.22.4"
Expand Down
23 changes: 13 additions & 10 deletions web/src/components/d3component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ import PropTypes from 'prop-types';
import { Spinner, Row, Col } from 'reactstrap';

const D3Component = React.memo(({ callback, data, useDiv = false }) => {
if (data === null)
return (
<Row>
<Col className="text-center">
<Spinner style={{ width: '3rem', height: '3rem' }} />
</Col>
</Row>
);
const ref = useRef();
useEffect(() => {
callback(ref.current, data);
data && callback(ref.current, data);
});
return useDiv ? <div ref={ref} /> : <svg ref={ref} />;

return data === null ? (
<Row>
<Col className="text-center">
<Spinner style={{ width: '3rem', height: '3rem' }} />
</Col>
</Row>
) : useDiv ? (
<div ref={ref} />
) : (
<svg ref={ref} />
);
});

D3Component.propTypes = {
Expand Down
Loading