-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dashboard crashes when report doesn't contain rows #3983
Comments
Note: this is possibly related to #3880 |
Thanks, @johnPhillips. Looks like the same problem exists in the site-kit-wp/assets/js/modules/analytics/components/dashboard/DashboardGoalsWidget.js Line 164 in f54254f
|
Thanks @eugene-manuilov, good catch. I just spent a bit of time looking for any more but I think that's all of them now. I'll update the IB with this one 👍 |
IB ✔️ |
Note: I ended up implementing this as part of #3880 as there was some overlap with that issue. Moving to QA. |
Bug Description
During testing the plugin on my local machine, I encountered a situation when Google Analytics API returns a report with an empty
rows
property. I suspect it happens because the selected Analytics account has no data, which is fine. What is not fine is that theDashboardSearchVisitorsWidget
widget tries to access the report data rows length without checking whether rows is an actual array:site-kit-wp/assets/js/modules/analytics/components/dashboard/DashboardSearchVisitorsWidget.js
Lines 174 to 182 in 0c40e3a
This leads to fatal errors and the whole dashboard crashes. We need to make sure that widgets display zero states if there are no rows in the report data.
Additional details:
Report arguments
Report response
Screenshots
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
includeEmptyRows
is enabled for a request.Implementation Brief
assets/js/modules/analytics/components/dashboard/DashboardSearchVisitorsWidget.js
, default thedataRows
assignment to an empty array if thesparkData
array is empty, for example by using optional chaining:site-kit-wp/assets/js/modules/analytics/components/dashboard/DashboardGoalsWidget.js
, repeat the step above to default thedataRows
assignment on line 164 to an empty array.Test Coverage
Visual Regression Changes
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: