Skip to content

Fix SingleStat undefined error when receiving empty dataset from Cube

What does this MR do and why?

Fixes an error thrown in the SingleStat data extraction function when receiving a response form CubeJS containing en empty dataset.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

  1. Follow these instructions to setup Product Analytics in GDK.
  2. Visit a dashboard in an onboarded project containing a SingleStat visualization
  3. Make CubeJS return an empty dataset for this panel ("data": [])
fudging the response

I wasn't sure how to exactly replicate the original issue (internal slack link) as responses always contained the measure with null when there was no data, instead of being completely empty.

So I used devtools content override and set a response JSON with an empty data array

  1. Ensure panel shows 0 and does not throw error

Related to #439176 (closed)

Edited by Elwyn Benson

Merge request reports