Repository navigation
Conversation
A new screener's benefits list comes back from the API as null normalizeBenefitName also treats a missing name as an empty string
- Show the load error instead of crashing when the library benefits fail to load - Keep the benefit being added in the list until the modal closes, instead of letting it flash out when the screener refetches - Show only one of the loading, error, empty and all-added messages at a time
sahilds1
marked this pull request as ready for review
November 13, 2026 16:45
prestoncabe
approved these changes
Nov 17, 2026
prestoncabe
left a comment
Collaborator
There was a problem hiding this comment.
LGTM... I think it would be good to note the name-matching limitation in the "User Guide" doc page (in a way that would make sense to a user). And I think this is fine in general for now (arguably, it is a feature, but we can make that more clear later if needed).
| import type { Benefit } from "@/types"; | ||
|
|
||
| // Treat a missing name as an empty string | ||
| const normalizeBenefitName = (name: string | null | undefined) => |
Collaborator
There was a problem hiding this comment.
normalizeBenefitName is similar/same as logic in ImportScreenerForm.tsx:19 and PrintSummary.ts:38. Maybe extract a helper to /src/utils/?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The "Add library benefit" picker no longer lists library benefits that are already in the screener. When every library benefit has been added, it says so instead of showing an empty list.
An imported library benefit is saved as an independent copy with a new ID and no link back to the library benefit it came from. So names are the only way the frontend can tell what's already in the screener. A library benefit is hidden when its name matches a screener benefit's name, ignoring case and leading or trailing spaces.
Known limits of matching by name
Storing the source library benefit ID on the imported copy, and rejecting duplicate imports on the backend, would fix all five
GitHub Issue: #571
Verification
New screener: Every library benefit is listed and nothing crashes
Hide added benefits: Added one benefit, reopened the picker and the benefit is no longer listed
All added: Added every library benefit
Load error: Blocked the request URL
library-benefitsand opened the pickerDocumentation impact