Skip to content

Commit

Permalink
fix: don't render pivot table before data has loaded (#635)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin <martin@moid.se>
  • Loading branch information
amcgee and martinkrulltott committed Feb 10, 2020
1 parent b2742e8 commit 844d989
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/plugin/src/PivotPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const PivotPlugin = ({
d2,
onLoadingComplete,
}) => {
const [visualization, setVisualization] = useState(null)
const [data, setData] = useState(null)

useEffect(() => {
Expand All @@ -58,7 +57,6 @@ const PivotPlugin = ({
if (onResponsesReceived) {
onResponsesReceived(responses)
}
setVisualization(config)
setData(responses[0].response)
onLoadingComplete()
})
Expand All @@ -71,7 +69,7 @@ const PivotPlugin = ({

return (
<div style={{ width: '100%', height: '100%', ...style }}>
<PivotTable visualization={visualization} data={data} />
{!data ? null : <PivotTable visualization={config} data={data} />}
</div>
)
}
Expand Down

0 comments on commit 844d989

Please sign in to comment.