Skip to content

Organization editor submits the previous name after changing or clearing the input #442

Description

@3219378872

Organization editor can submit the previous name after the input is changed or cleared

When editing an existing organization name, the visible text can differ from the value submitted by the form. Typing a different name that has autocomplete suggestions, without selecting a suggestion, still submits the original organization. Clearing the input also submits the original organization instead of triggering the required-field validation.

Reproduction on main at d709b1898549c5ab4091302a4c26f45bbe198c66:

  1. Edit an existing organization entry (for example Original Org) with valid start/end dates.
  2. Replace its name with New Org, which has a matching suggestion, but do not click the suggestion.
  3. Click Confirm. The modifyUserOrgs variables still contain orgName: "Original Org", even though the input shows New Org.
  4. In a fresh edit, clear the name and click Confirm. The same old name is submitted, with no required-field error.
  5. As a control, clicking the New Org suggestion before confirming submits New Org correctly.

Expected: the form value tracks the visible input. A nonempty name should be submitted as entered (or explicitly rejected if invalid); an empty required name should prevent submission. Suggestion loading/results should not determine whether the form notices a text edit.

OrgInput.tsx currently updates only its local keyword on typing. It calls the parent onChange only after a search returns zero suggestions or when a suggestion is clicked. Thus Ant Design's form retains the previous value while the visible input changes. The same shared input is used by the organization editing forms.

Verified with actual OrgEdit, OrgInput, DateRangePicker, Ant Design Form/Input/RangePicker, Compass Button, generated GraphQL query/mutation hooks, and React Query in Chromium, in both English and Chinese. The GraphQL client transport was replaced with deterministic synthetic responses and captured mutation variables locally; no real profile or backend was contacted. In all four failure cases (two cases × two languages), the old name was submitted. Both suggestion-selection controls submitted the selected name, with no page errors.

Historical #305 introduced this input; #306 only adjusted its spinner placement. Existing #432 changes logging in the parent forms and does not address input/form synchronization.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions