Skip to content

fix: add constants, change payload structure, new company on input#784

Open
tomrndom wants to merge 2 commits intomasterfrom
fix/sponsor-user-process-new
Open

fix: add constants, change payload structure, new company on input#784
tomrndom wants to merge 2 commits intomasterfrom
fix/sponsor-user-process-new

Conversation

@tomrndom
Copy link

@tomrndom tomrndom commented Feb 6, 2026

ref: https://app.clickup.com/t/86b8e1vcf

Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com

Summary by CodeRabbit

  • Refactor

    • Standardized sponsor assignment types for consistent handling and validation of existing vs. new sponsor selections.
  • New Features

    • Company input now supports creating new company entries inline and improves debounce/fetch behavior for smoother autocomplete.

@tomrndom tomrndom requested a review from smarcet February 6, 2026 17:37
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Adds a new SPONSOR_USER_ASSIGNMENT_TYPE enum, refactors sponsor-type handling to use it, and enhances CompanyInputMUI with allowCreate, debounced fetching, option creation, and improved option labeling/rendering.

Changes

Cohort / File(s) Summary
Constants
src/utils/constants.js
Adds SPONSOR_USER_ASSIGNMENT_TYPE export with { EXISTING: "existing", NEW: "new" }.
Sponsor actions & form
src/actions/sponsor-users-actions.js, src/pages/sponsors/sponsor-users-list-page/components/process-request-form.js
Replaces literal "existing"/"new" with SPONSOR_USER_ASSIGNMENT_TYPE across payload construction, initial values, validation, radio options, disabled states, and conditional rendering.
Company autocomplete input
src/components/mui/formik-inputs/company-input-mui.js
Introduces allowCreate prop, debouncing state, create-option support in filter logic, improved getOptionLabel/renderOption handling, and PropTypes update. Many UI/behavior changes for option creation and input normalization.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • smarcet

Poem

🐇 I hopped through constants, tidy and new,
Replaced loose strings with a tidy two —
EXISTING, NEW, in a neat little row,
I nibble code carrots and watch features grow! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately summarizes the main changes: adding constants (SPONSOR_USER_ASSIGNMENT_TYPE), restructuring payload handling for sponsor types, and enabling company creation from input.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/sponsor-user-process-new

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom tomrndom force-pushed the fix/sponsor-user-process-new branch from 7b09f66 to 443fd6f Compare February 6, 2026 18:23
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/mui/formik-inputs/company-input-mui.js (1)

92-110: ⚠️ Potential issue | 🟡 Minor

Handle create-option values in multi-select when allowCreate is enabled.

The multi-select path doesn't normalize inputValue like the single-select path does. When users create a new entry:

  • With plainValue: stores 'Create "..."' instead of the user input text
  • Without plainValue: calls parseInt(v.value) where v.value is null (created at line 129), resulting in NaN ids

Apply the same inputValue handling from the single-select path (lines 106–109):

  • plainValue: v.inputValue || v.label
  • id: v.inputValue ? 0 : parseInt(v.value)
🔧 Proposed fix
   } else if (isMulti) {
     theValue = plainValue
-      ? newValue.map((v) => v.label)
-      : newValue.map((v) => ({
-          id: parseInt(v.value),
-          name: v.label
-        }));
+      ? newValue.map((v) => v.inputValue || v.label)
+      : newValue.map((v) => ({
+          id: v.inputValue ? 0 : parseInt(v.value),
+          name: v.inputValue || v.label
+        }));
   } else {

@tomrndom tomrndom changed the title fix: add constants, wip change payload structure fix: add constants, change payload structure, new company on input Feb 6, 2026
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