Skip to content

Commit

Permalink
fix: Pass correct style prop to chart plugin on resize & update snaps…
Browse files Browse the repository at this point in the history
…hots (backport to v32) (#300)
  • Loading branch information
neeilya authored Apr 30, 2019
1 parent f5a8aa1 commit deea0a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@dhis2/d2-ui-rich-text": "^5.3.10",
"@dhis2/d2-ui-sharing-dialog": "^5.3.10",
"@dhis2/d2-ui-translation-dialog": "^5.3.10",
"@dhis2/data-visualizer-plugin": "^32.0.3",
"@dhis2/data-visualizer-plugin": "32.0.6",
"@dhis2/ui": "1.0.0-beta.15",
"@dhis2/ui-core": "^1.1.3",
"@material-ui/core": "^3.9.2",
Expand Down
5 changes: 4 additions & 1 deletion src/components/Item/VisualizationItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export class Item extends Component {
super(props);

this.d2 = context.d2;

this.contentRef = React.createRef();
}

async componentDidMount() {
Expand Down Expand Up @@ -268,7 +270,7 @@ export class Item extends Component {
? {
height: item.originalHeight - HEADER_HEIGHT - PADDING_BOTTOM,
}
: { height: '100%' };
: { height: this.contentRef.offsetHeight };
};

render() {
Expand All @@ -285,6 +287,7 @@ export class Item extends Component {
<div
key={this.getUniqueKey(itemFilters)}
className="dashboard-item-content"
ref={ref => (this.contentRef = ref)}
>
{this.state.configLoaded && this.getPluginComponent()}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ ShallowWrapper {
"children": false,
"className": "dashboard-item-content",
},
"ref": null,
"ref": [Function],
"rendered": false,
"type": "div",
},
Expand Down Expand Up @@ -296,7 +296,7 @@ ShallowWrapper {
"children": false,
"className": "dashboard-item-content",
},
"ref": null,
"ref": [Function],
"rendered": false,
"type": "div",
},
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1096,13 +1096,13 @@
recompose "^0.26.0"
rxjs "^5.5.7"

"@dhis2/data-visualizer-plugin@^32.0.3":
version "32.0.3"
resolved "https://registry.yarnpkg.com/@dhis2/data-visualizer-plugin/-/data-visualizer-plugin-32.0.3.tgz#70552cb7b4f3240d4eebb14f685788b49dd5d145"
integrity sha512-1aFTOz7KiCcEmyZNGJDjpdbIW2kUrQTXPTCGjHXFF8EorTXBPf4Avw+rEKajGuhlJ9f1+gCGr21BP6rQOgZOUA==
"@dhis2/[email protected].6":
version "32.0.6"
resolved "https://registry.yarnpkg.com/@dhis2/data-visualizer-plugin/-/data-visualizer-plugin-32.0.6.tgz#9cbc7c90ac76ebda4f74469a05437f972d8a71e1"
integrity sha512-+M3Nqh4fboSmLLIeJpFExM5ukL+JnaeFjecAZT/Ltv2dfG+G2HB84Gdgn3S8zaAALNJC6QfJ1bIu0l4dzkVOpA==
dependencies:
"@material-ui/core" "^3.1.2"
d2-charts-api "32.0.1"
d2-charts-api "32.0.6"
lodash-es "^4.17.11"
react "^16.6.0"
react-dom "^16.6.0"
Expand Down Expand Up @@ -3601,10 +3601,10 @@ cyclist@~0.2.2:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"
integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=

[email protected].1:
version "32.0.1"
resolved "https://registry.yarnpkg.com/d2-charts-api/-/d2-charts-api-32.0.1.tgz#f402a5352a08fe3281a437652afc2dc8fd7fd22e"
integrity sha512-s6VlDLCkcjNluOXwUp1csa/6ZaNDBtbu9RWmaa8kb5gPpc1BDovwx0lE34FPrEUIefF5JNpisl3fwlrLrH592Q==
[email protected].6:
version "32.0.6"
resolved "https://registry.yarnpkg.com/d2-charts-api/-/d2-charts-api-32.0.6.tgz#e733a5417a78186a0c4a9cce72bc616aa9dfbf79"
integrity sha512-pV+f+6oajrRcFn38Zo0m7arIcKUcMeQaGqkFLeg71YuGJC/iojEUQjhixPoTl+arHz+PTtok3o0nN73hKISU3Q==
dependencies:
d2-utilizr "0.2.13"
d3-color "1.0.1"
Expand Down

0 comments on commit deea0a4

Please sign in to comment.