Skip to content

Stop default participant preselection in Add Expense#6

Merged
ClementLSW merged 1 commit into
mainfrom
copilot/remove-default-selection-people
May 29, 2026
Merged

Stop default participant preselection in Add Expense#6
ClementLSW merged 1 commit into
mainfrom
copilot/remove-default-selection-people

Conversation

Copilot AI commented May 29, 2026

Copy link
Copy Markdown
Contributor

When creating a new expense, the form preselected all group members in the split, which made accidental broad splits likely. This change makes participant selection explicit by starting with no selected members.

  • Behavior change: new expense defaults

    • Updated AddExpense initialization to set selectedMembers to an empty list for create flow.
    • Edit flow remains unchanged and still hydrates participants from existing splits.
  • Submission guardrail

    • Added validation in computeSplits() for non-line_item modes to reject submits when no members are selected.
    • Returns a clear form error instead of creating an expense with empty splits.
  • Key code change

    if (!isEdit) {
      setSelectedMembers([])
      setPaidBy(profile?.id)
    }
    
    if (splitMode !== 'line_item' && selectedMembers.length === 0) {
      return { splits: [], error: 'Select at least one member' }
    }

@netlify

netlify Bot commented May 29, 2026

Copy link
Copy Markdown

Deploy Preview for omoneypmoney ready!

Name Link
🔨 Latest commit acb5058
🔍 Latest deploy log https://app.netlify.com/projects/omoneypmoney/deploys/6a199dc107f625000887437b
😎 Deploy Preview https://deploy-preview-6--omoneypmoney.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ClementLSW ClementLSW marked this pull request as ready for review May 29, 2026 14:09
Copilot AI review requested due to automatic review settings May 29, 2026 14:09
@ClementLSW ClementLSW merged commit 146296f into main May 29, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

3 participants