Skip to content

[8656] Item manager in Type Builder's form failing to save#4851

Open
jvega190 wants to merge 1 commit intocraftercms:developfrom
jvega190:bugfix/8656
Open

[8656] Item manager in Type Builder's form failing to save#4851
jvega190 wants to merge 1 commit intocraftercms:developfrom
jvega190:bugfix/8656

Conversation

@jvega190
Copy link
Copy Markdown
Member

@jvega190 jvega190 commented May 5, 2026

craftercms/craftercms#8656

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of field property serialization in content type management to correctly pass field descriptors.
    • Enhanced string value processing with defensive programming to prevent runtime errors when field properties are undefined.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: de94e939-070e-49e4-a4c5-1733fca6b530

📥 Commits

Reviewing files that changed from the base of the PR and between b067cd5 and 75f111f.

📒 Files selected for processing (2)
  • ui/app/src/components/ContentTypeManagement/utils.ts
  • ui/app/src/components/FormsEngine/lib/valueSerializers.ts

Walkthrough

Two changes improve serializer robustness: reverseTypeFieldValuesObject now passes fieldDescriptor (not null) to serializers, providing more context; prepareString uses optional chaining to safely handle undefined/null fields, preventing runtime errors.

Changes

Serializer Context Robustness

Layer / File(s) Summary
Serializer Contract
ui/app/src/components/ContentTypeManagement/utils.ts
reverseTypeFieldValuesObject passes fieldDescriptor to serializers instead of null, providing field metadata needed by serializers that depend on field context.
Defensive Field Handling
ui/app/src/components/FormsEngine/lib/valueSerializers.ts
prepareString uses optional chaining (field?.properties?.escapeContent?.value) to safely access properties when field or intermediate objects may be undefined, preventing runtime errors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • craftercms/craftercms#8656: Both changes address null/undefined field handling in serialization paths—passing more context to serializers and handling cases where that context is unavailable.

Possibly related PRs

  • craftercms/studio-ui#4836: Both PRs modify calls to value serializers to pass field/descriptor objects instead of null, establishing consistent serializer contracts.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the ticket number [8656] and describes the main issue being fixed (Item manager in Type Builder's form failing to save).
Description check ✅ Passed The description includes the ticket reference link as required by the template, though it only provides the link without additional context.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@jvega190 jvega190 marked this pull request as ready for review May 5, 2026 16:14
@jvega190 jvega190 requested a review from rart as a code owner May 5, 2026 16:14
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