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
fix(pages): update search results filtering #224
fix(pages): update search results filtering #224
Conversation
Accommodate multiple items of each record_type
return { | ||
...acc, | ||
[cur.record_type]: Array.isArray(acc[cur.record_type]) | ||
? [...acc[cur.record_type], cur] | ||
: [cur], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maxachis see this part of the code wrt bug fix for #217. The previous logic was keying an object by record_type
but forgot to take into account that there might be multiple records of the same type. To fix this bug, we're instead assigning an array to each of those keys, to accommodate multiple values of each key. The updates to the template
above are in service of this change (as well as some general cleanup, as we're moving away from the GridContainer
and GridItem
components).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that would make sense. So regardless of whether there's one record or multiple, it is formatted into an array, simplifying the logic on the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that would make sense. So regardless of whether there's one record or multiple, it is formatted into an array, simplifying the logic on the backend.
Yeah @maxachis I think @mbodeantor and I are aligned on the idea that the API should be as simple as possible, and any complex manipulation required by UX or design requirements should be handled by the client.
Get count from API results Misc template cleanup
Handle UI more elegantly
To test
/search/health/allegheny