Repository navigation
Keep duplicated repeaters linked to their own child forms - #3722
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit details
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. |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| PHP | Nov 17, 2026 7:07p.m. | Review ↗ | |
| JavaScript | Nov 17, 2026 7:07p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
Approve. One non-blocking note inline.
Before/after repro (live, local preview env, Lite on PR #3722 + Pro): form with a repeater (form_select_6 = child form 3). I duplicated it in the builder by the real duplicateField click handler.
- Base
js/formidable_admin.js(confirmed served, nofrm_repeat_fieldin it): the duplicate came back withfield_options[form_select_13]=3, the same child form as the original, so both repeaters point at one child form. - PR bundle: the duplicate came back with
field_options[form_select_10]=4, its own new child form; the original stayed on 3.
The evidence is hidden-input values read from the DOM. No screenshot is attached because nothing visible changes; the visual builder pass was not exercised.
Selector check: .frm_repeat_field is Pro's hidden input field_options[repeat_<id>] (frmpro-fields/options-form-top.php), value 1 for a repeater, not a checkbox, one per settings panel. Non-repeaters fall through to the old copy behaviour.
Tests run: node --test tests/js/duplicateFieldSettings.test.mjs at 5bbc5ff → 2/2 pass; with js/src/admin/duplicateFieldSettings.js reverted to master the repeater test fails (form_select stays original-form_select). CI skipped the JS unit tests job at this head, so this is the only run. The other two files in tests/js/ failed to load in my scratch checkout (@babel/core missing, no node_modules); they are untouched by this PR and were not run.
The rebuilt js/formidable_admin.js contains the new frm_repeat_field/form_select_ check (verified by the live run above); I did not byte-compare a rebuild, since webpack output is not reproducible on this machine.
| const settings = { | ||
| dataset: { fid: '202' }, | ||
| querySelectorAll: () => targets, | ||
| querySelector: () => repeat === null ? null : { value: repeat }, |
There was a problem hiding this comment.
Non-blocking: this stub returns the same object for any selector, so the test would still pass if the source queried a different class or element. The live run above covered the real selector, but the unit test cannot catch a rename. Make the stub answer only for the selector the code uses (I ran this: 2/2 still pass):
| querySelector: () => repeat === null ? null : { value: repeat }, | |
| querySelector: selector => selector === '.frm_repeat_field' && repeat !== null ? { value: repeat } : null, |
Duplicating a repeater creates a new child form, but copying the source's unsaved settings overwrote that child-form ID with the original repeater's ID. Preserve the generated reference for repeaters while continuing to copy unsaved selections for other field types. Rebuild the builder bundle.
Testing: the new repeater regression failed before the fix and passes afterward. All 66 JavaScript tests pass. Scoped Oxlint, ESLint and typos checks pass, with one existing ESLint warning in
cloneCurrentMarkup.