Guard manual Add Member flow at max member cap#156
Conversation
Sendi0011
left a comment
There was a problem hiding this comment.
@Stella112 Really nice work here — especially catching that BulkImport.tsx was showing a "too many members" warning but still letting everything through unfiltered. Actually slicing to the limit is a real bug fix, not just a refactor. The aria-describedby touch on the disabled button is a nice extra too.
One small thing, not blocking: isMemberLimitReached compares against members.length, which excludes the creator (added back separately via allMembers), so the manual-add path caps at 51 total participants while the CSV path caps at exactly 50. Worth a quick look if you want both paths to land on the exact same number, but it's a minor enough gap that I wouldn't hold this up over it.
Also, heads up: you'll likely see a prefill-related tsc error on this branch right now — that's not from anything in this PR, it's because #155 (which wires up prefill in page.tsx) hasn't merged yet. Should clear up on its own once that one's in. Approving this either way — just sequencing things so CI doesn't show noise that's unrelated to your work here.
PR JointSave-org#156 (merged separately) added MAX_POOL_MEMBERS and an isMemberLimitReached guard to addMember in the same forms this branch touches. Kept that guard and dropped the now-removed setMemberErrors plumbing it referenced in target-form.tsx and flexible-form.tsx.
Closes #144
Description
Adds a shared
MAX_POOL_MEMBERSconstant and uses it across the CSV bulk importer plus all three manual member entry forms.Manual Add Member buttons now stop at the same 50-member cap as CSV import, disable when the cap is reached, and show a clear "Maximum of 50 members reached" message.
The CSV path now also caps the accepted members passed into parent form state to the shared limit.
Type of Change
How Has This Been Tested?
git diff --checknext buildwith placeholder env values fromfrontend/.env.examplepnpm lintpasses (frontend)pnpm lintis blocked by the existing Next 16 tooling issue wherenext lintis treated as a project directory.Checklist
Screenshots (if applicable)
N/A