Skip to content

Contribution categorization#11929

Open
hdiniz wants to merge 6 commits intomainfrom
contribution-categorization
Open

Contribution categorization#11929
hdiniz wants to merge 6 commits intomainfrom
contribution-categorization

Conversation

@hdiniz
Copy link
Contributor

@hdiniz hdiniz commented Feb 24, 2026

@hdiniz hdiniz self-assigned this Feb 24, 2026
@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opencollective-frontend Ready Ready Preview, Comment Feb 25, 2026 0:22am

Request Review

@hdiniz hdiniz marked this pull request as ready for review February 25, 2026 17:18
@hdiniz hdiniz requested a review from Betree February 25, 2026 17:18
Comment on lines +176 to +180
props.onChange({
subject: field,
operator: ops?.includes(props.condition.operator) ? props.condition.operator : ops?.[0],
value: null,
});
Copy link

Choose a reason for hiding this comment

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

Bug: Changing a predicate's subject sets its value to null, which is not allowed by the Zod schema, causing an immediate validation error to appear during form editing.
Severity: MEDIUM

Suggested Fix

Either update the Zod schema in schema.ts to permit null values by adding .nullable() to the value field definition, or modify RuleForm.tsx to set the value to an empty string ('') instead of null when the subject changes.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: components/accounting/dashboard/categorization/RuleForm.tsx#L176-L180

Potential issue: When a user edits a categorization rule and changes a predicate's
`subject` field, the `onChange` handler in `RuleForm.tsx` programmatically sets the
corresponding `value` field to `null`. However, the Zod validation schema for the form
does not permit `null` for this field. Because validation is triggered on every field
change, this immediately and incorrectly displays a validation error to the user,
disrupting the form editing experience even though the user has not finished their
input.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

1 participant