Skip to content
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

Merged
merged 5 commits into from Mar 19, 2024

Conversation

joshuagraber
Copy link
Contributor

@joshuagraber joshuagraber commented Mar 19, 2024

To test

  1. Run the app locally.
  2. Navigate to /search/health/allegheny
  3. Ensure 3 records are displayed (in contrast to the same route in prod, which currently shows 1).

Accommodate multiple items of each record_type
@joshuagraber joshuagraber self-assigned this Mar 19, 2024
Comment on lines +117 to +122
return {
...acc,
[cur.record_type]: Array.isArray(acc[cur.record_type])
? [...acc[cur.record_type], cur]
: [cur],
};
Copy link
Contributor Author

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).

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@mbodeantor mbodeantor merged commit a35e2c7 into main Mar 19, 2024
8 checks passed
@joshuagraber joshuagraber deleted the fix/search-results-returning-one-of-each-type branch March 20, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

search bug: not showing results for health inspections
3 participants