Skip to content

[#571] Improve library benefit picker - #592

Open
sahilds1 wants to merge 3 commits into
CodeForPhilly:mainfrom
sahilds1:571-improve-library-benefit-picker
Open

sahilds1 wants to merge 3 commits into
CodeForPhilly:mainfrom
sahilds1:571-improve-library-benefit-picker

Conversation

@sahilds1

@sahilds1 sahilds1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Renamed imports show up again. Renaming an imported benefit makes the library version appear in the picker again, so it can be imported a second time. This is how the picker behaved before this change.
  • Same-name custom benefits. A custom benefit that shares a library benefit's name hides that library benefit.
  • Same-name library benefits. Library benefits that share a name all disappear once any one of them is imported.
  • Blank names. Blank or missing names all match each other, so an unnamed screener benefit hides unnamed library benefits.
  • No backend check. The backend still accepts duplicate imports, for example from two open tabs or a direct API call.

GitHub Issue: #571

Verification

New screener: Every library benefit is listed and nothing crashes

Screenshot 2026-11-13 at 11 09 07 AM

Hide added benefits: Added one benefit, reopened the picker and the benefit is no longer listed

Screenshot 2026-11-13 at 11 10 03 AM Screenshot 2026-11-13 at 11 10 21 AM Screenshot 2026-11-13 at 11 10 31 AM Screenshot 2026-11-13 at 11 10 40 AM

All added: Added every library benefit

Screenshot 2026-11-13 at 11 20 35 AM

Load error: Blocked the request URL library-benefits and opened the picker

Screenshot 2026-11-13 at 11 30 35 AM

Documentation impact

  • I updated affected documentation, or this change does not alter user-visible behavior, commands, configuration, APIs, or contributor workflows.

@sahilds1 sahilds1 self-assigned this Nov 6, 2026
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
sahilds1 marked this pull request as ready for review November 13, 2026 16:45
@sahilds1 sahilds1 changed the title [WIP][#571] Improve library benefit picker [#571] Improve library benefit picker Nov 13, 2026

@prestoncabe prestoncabe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

No deployments
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.

2 participants