diff --git a/assets/js/dashboard/stats/conversions/index.js b/assets/js/dashboard/stats/conversions/index.js index e1248836b..1aef2cdb7 100644 --- a/assets/js/dashboard/stats/conversions/index.js +++ b/assets/js/dashboard/stats/conversions/index.js @@ -14,6 +14,7 @@ const DEFAULT_WIDTH = 1080 export default class Conversions extends React.Component { constructor(props) { super(props) + this.htmlNode = React.createRef() this.state = { loading: true, viewport: DEFAULT_WIDTH, @@ -42,7 +43,8 @@ export default class Conversions extends React.Component { componentDidUpdate(prevProps) { if (this.props.query !== prevProps.query) { - this.setState({loading: true, goals: null}) + const height = this.htmlNode.current.element.offsetHeight + this.setState({loading: true, goals: null, prevHeight: height}) this.fetchConversions() } } @@ -54,7 +56,7 @@ export default class Conversions extends React.Component { fetchConversions() { api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/conversions`, this.props.query) - .then((res) => this.setState({loading: false, goals: res})) + .then((res) => this.setState({loading: false, goals: res, prevHeight: null})) } renderGoalText(goalName) { @@ -123,7 +125,7 @@ export default class Conversions extends React.Component { render() { return ( - + { this.renderInner() } ) diff --git a/lib/plausible_web/templates/stats/stats.html.eex b/lib/plausible_web/templates/stats/stats.html.eex index 834066671..25c7d3548 100644 --- a/lib/plausible_web/templates/stats/stats.html.eex +++ b/lib/plausible_web/templates/stats/stats.html.eex @@ -5,7 +5,7 @@ <% end %>
-
+
<%= if !@conn.assigns[:current_user] && @conn.assigns[:demo] do %>