insights: `seriesCount` field does not fail whole gql query
Created by: leonore
tackles part of #38951
-
SeriesCount
return value is made nullable - use
errorPolicy: ’all'
oninsightViews
queries in the webapp
nb. this isn't a catch-all fix, but this creates a blueprint if we are to add more fields to query in the future. I believe that right now SeriesCount
is the only query that can fail in this way
some background:
graphql allows to return both data and errors in its response. however:
- in graphql, if there is an error on a non-nullable field then its whole parent is errored (spec)
so if we make a field nullable we'll be able to get both data and errors. however that must still be handled correctly by the client.
- the apollo client allows to set an error policy we can use (docs)
Test plan
The following test plan was ran on both main
and commit c8524fee4662257ab218a7c08873c77dd613754a (parent of this PR which removed seriesCount
and the issue)
- Test ’All insights’ page works, even when an individual insight errors
- Test a specific dashboard page works, even when an individual insight errors
- Test single-insight page works, even when the insight errors.
Screenshots:
before:
all insights | dashboard | single insight |
---|---|---|
after:
all insights | dashboard | single insight |
---|---|---|