fix(bu-edit): restore 13 fields dropped by the one-document rewrite + guard required fields#34
Merged
Merged
Conversation
… guard required fields The one-document rewrite (87d9f0f) deleted the per-section form components and re-rendered fields by hand, silently dropping 13 that reach formData but had no control — so they could never be set on create nor edited. `code` was one of them, which made every create fail with HTTP 400 "code field is required". - BusinessUnitDocument.tsx: add the 13 missing fields back (code, hotel_name, company_tel/email, full company address, long/short time format). Split the merged "Company & tax" group into distinct Company and Tax groups and prefix company address labels so hotel/company fields no longer share aria-labels. - BusinessUnitEdit.tsx: add validateRequired() so a blank cluster_id/code/name never fires a doomed request (backend requires these per swagger). Surfaces errors in the banner and inline, aborting before the POST. - Tests: BusinessUnitDocument.test.tsx covers all 38 editable fields (mechanical regression guard); BusinessUnitEdit.test.tsx adds block-on-missing-code and create-when-valid cases. Verified end-to-end against the local backend: create now POSTs 201. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Creating a Business Unit failed with HTTP 400
code field is requiredand there was no Code input on the page.Root cause: the one-document rewrite (
87d9f0f) deleted the per-section form components (BasicInfoSection,HotelInfoSection,CompanyInfoSection,DateTimeFormatsSection) and re-rendered fields by hand — silently dropping 13 fields that still reachformDatabut had no control. They could never be set on create nor edited. Existing values round-trip safely (loaded + sent back), so this was a create/edit UX break, not data loss.Dropped fields:
code,hotel_name,company_tel,company_email,company_address_line2,company_sub_district,company_district,company_province,company_postal_code,company_latitude,company_longitude,long_time_format,short_time_format.Changes
BusinessUnitDocument.tsx— add all 13 fields back. Split the merged "Company & tax" group into distinct Company and Tax groups; prefix company address labels so hotel/company fields no longer sharearia-labels (a11y).BusinessUnitEdit.tsx— addvalidateRequired(): a blankcluster_id/code/nameno longer fires a doomed request (backend requires these per swagger/api-system/business-unitsPOST). Errors surface in the banner + inline, aborting before the POST (satisfies CLAUDE.md rule 14).BusinessUnitDocument.test.tsxcovers all 38 editable fields as a mechanical regression guard;BusinessUnitEdit.test.tsxadds block-on-missing-code and create-when-valid cases.Verification
Follow-up (separate, pre-existing)
InlineField
selectcan't commit its first-displayed option whenformDatastarts empty (no matching option → browser shows option 0 but state stays''). Fix would add an empty placeholder option as default. Not in scope here.🤖 Generated with Claude Code