Skip to content

Fix: distribution "Add Entry" crashes — remove html field from CF5 complex group#13

Merged
daimpad merged 1 commit intomainfrom
claude/evaluate-change-requests-FEyiS
May 6, 2026
Merged

Fix: distribution "Add Entry" crashes — remove html field from CF5 complex group#13
daimpad merged 1 commit intomainfrom
claude/evaluate-change-requests-FEyiS

Conversation

@daimpad
Copy link
Copy Markdown
Owner

@daimpad daimpad commented May 6, 2026

Problem

Clicking "Add Entry" in Tab 3 (Datenbereitstellung) caused the entire distribution field to disappear. Root cause: CF5 renders complex fields with React, and an html-type field inside add_fields() crashes the React renderer when a new entry is added.

Fix

  • Remove Field::make('html', 'byte_size_ui') and the now-unused get_filesize_widget_html() PHP method from the complex field definition
  • The composite file-size widget (number input + KB/MB/GB dropdown) is now built and inserted dynamically by odw-admin-fields.js, adjacent to the hidden [data-odw-backing="byte_size"] input
  • Translated strings passed via wp_localize_script (odwAdminFields.fileSizeWidget)
  • MutationObserver updated to watch for input[data-odw-backing="byte_size"] in newly added nodes (instead of .odw-filesize-widget)

Test plan

  • Tab 3 → click "Add Entry" → distribution form appears correctly
  • File size widget (number + unit) is visible and functional in each distribution
  • Entering a value computes bytes and syncs to the hidden backing field
  • Stored byte values are restored as human-readable display on page reload
  • Multiple distributions can be added without issues
  • All 90 PHPUnit tests pass

https://claude.ai/code/session_FEyiS


Generated by Claude Code

…ia JS

CF5 renders complex fields with React. An html-type field inside a
complex field's add_fields() crashes the React renderer when "Add Entry"
is clicked, causing the entire distribution group to disappear.

Fix: remove byte_size_ui html field from the complex field definition
and the now-unused get_filesize_widget_html() PHP method. The composite
filesize widget (number + unit dropdown) is now built and inserted
dynamically by odw-admin-fields.js next to the hidden backing input
([data-odw-backing="byte_size"]). Translated strings are passed via
wp_localize_script (odwAdminFields.fileSizeWidget).

https://claude.ai/code/session_FEyiS
@daimpad daimpad merged commit 723b8fd into main May 6, 2026
10 checks passed
@daimpad daimpad deleted the claude/evaluate-change-requests-FEyiS branch May 6, 2026 11:26
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.

2 participants