ResultGrid: Don't hard-fail if some cell value is missing in filter checkboxes #2083
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #1739.
Currently, if some of the rows contain filter values that do not correspond to any values in the grid header, the javascript will error out (because we're accessing
.values
ofundefined
). Conceptually, the datagrid assumes that the header checkboxes it is passed always perfectly match the data given. Due to outdated caches, this might not be the case.To test this, simply merge two course types and then open the results page.
I'm open for other suggestions of how to handle this in javascript. Having
undefined
as a stored filter value seems semantically useful to me, but we can also coalesce tofalse
. I'd also be open to issue a warning to the console if this happens, to make potential future debugging easier.It is still non-perfect if we run into the outdated caches situation because now there will be rows that can not be filtered for, but at least the rest of the datagrid will function as expected. Users would simply be missing the right checkbox. I've been thinking about making the ResultGrid build the header checkboxes, but currently that really isn't its responsibility, so that would be a bigger change.
IMO, this change doesn't make it "good", but it makes it better, which is somewhat overdue.