Closed tofumatt closed 3 years ago
Thanks @tofumatt – I think there are some details left to consider here.
getReport
arguments that it doesn't use itself is a bit too fragile and could result in extra queries triggered in the event something changes in another component and these exact args are no longer shared.
PreviewBlock
just on the initial render – it would be odd UX for this to go back into a loading state when you select a different dimensionnull
for an error
or zero data state because then the user would be "trapped" in that dimension. Similar to a date range with no data, the user still needs to be able to select a different one.This is a bit of a tricky UX problem as-is; the easiest solution to which would simply be to not to use ReportZero
within the sub-components but that would be a big difference than it is now visually. Otherwise, it seems like the only solution would be to select data from all available dimensions and then only show ReportZero
for the entire widget (when there really is zero data for any dimension) rather than specific sections; this sounds like too much from an API/data/quota perspective though. Widgets are supposed to only show this once for the whole widget anyways, not sure why we have it on both sides for this one 🤔
Let's talk about this one with @felixarntz on our call later since there are some considerations here that we need his input on.
@tofumatt Reviewing this, there is actually a benefit of still passing through each request error
to its respective component: When e.g. selecting a pie slice, only the data on the left is refreshed. If an error happens there, it means only the UI for that pie slice (the left half of the widget specifically) should indicate the error state. It's unlikely that this will happen, but in that case the overall widget is still usable, so there shouldn't be a global error.
I suggest the following adjustment:
loading
, error
, and data
/ report
to the child components. Basically, the child components shouldn't be modified, except that they receive this information from props instead of useSelect
. The logic flow in those component should be unchanged.cc @aaemnnosttv @eugene-manuilov
@felixarntz Oh, good call. That makes sense; I've updated the IB 👍🏻
IB looks good to me 👍
IB ✅ from my end, waiting for @eugene-manuilov's feedback
IB :heavy_check_mark:
Moving to the execution column and will work on it tomorrow morning.
In no data state, the widget shows the same full-area ReportZero
component as in the legacy widget
When the All Traffic Widget doesn't have any data to show, the tabs that allow the user to select their dimension should not appear, because there's no data to filter. Currently, the tabs appear even when
isZeroData( report )
istruth
-y, but they should only be shown whenisZeroData( report )
isfalse
-y.Screenshots
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
DashboardAllTrafficWidget
, the entire component should show a "Zero data" or "error" state, and not render the individual children components/charts.Implementation Brief
After a call with @felixarntz, @aaemnnosttv, and @eugene-manuilov, we decided the best solution is to move all selectors for the
DashboardAllTrafficWidget
children components into theDashboardAllTrafficWidget
component itself, then pass theloading
anddata
/report
variables to the child components as props. Data inerror
(from thegetErrorForSelector
selector) should not be passed to children—instead, if the component haszeroData
from theUserDimensionsPieChart
component or an error state, one large "zero data" or "error" state should be rendered.loading
/error
/getReport
selectors fromTotalUserCount
,UserCountGraph
, andUserDimensionsPieChart
toDashboardAllTrafficWidget
.loading
anddata/report
variables as props to their respective componentsuseEffect
/useState
). If this is done,dateRange
updates should trigger a fullloading
state.error
or "zero data" state as a result for theUserDimensionsPieChart
request. That one is the only request which on failure/zero would indicate the entire widget is unusable. If that component'sgetReport
requests has noerror
and is not "zero data" then each child component with its own error/loading/report variables should be rendered.Test Coverage
Visual Regression Changes
QA Brief
Changelog entry