Repository navigation
Load Formidable admin JavaScript by screen - #3761
Crabcyborg wants to merge 2 commits into
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 41 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. |
There was a problem hiding this comment.
Approve at d8cf622. I checked this refactor mechanically and in a live browser; I did not read all ~12k moved lines one by one (see Not run).
What I ran
node --test tests/js/*.test.mjsatd8cf622→ 88 pass, 0 fail. CI skips the JS unit job on this PR, so this run is the only one.- ESLint over
js/src/adminandjs/formidable_builder.js: zerono-undefhits, so no identifier lost its definition in the move. The only errors are three "rule not found" for sonarjs rules missing from my localnode_modules, on lines that master already has. - Rebuilt with
NODE_ENV=production webpackand compared against the committed bundles (formidable_admin,formidable_builder,formidable-form-settings,frm_testing_mode): the sets of string literals are the same. The only differences are webpack module ids (different checkout path), so the checked-in bundles match the source. The newjs/*.js.LICENSE.txtare gitignored like the existing ones. - Cypress passed on all four shards at this head (run 46048209041, read from the run, not re-run).
- Line-level check of the move: of the 12,708 lines removed from the touched
js/srcfiles, the 426 that no longer appear anywhere are mostly state variables now read asbuilder.state.*,frmDomdestructuring and therequirelines. Nothing in that list is a dropped feature.
Live, preview env with Lite at the PR head and Pro/add-ons active (Lite reset to master afterwards)
- Each screen loads only its own page script and has no uncaught errors: forms list and dashboard (admin only), builder (
formidable_builder.js), form settings (formidable-form-settings.js), global settings, import/export, entries, styles.frmAdminBuild.buildInitandinsertFormFieldexist only on the builder,infoModaleverywhere. Pro and the add-ons on the builder page ran without errors. - Builder: renamed a field, clicked Update, reloaded → label kept. Added an Email field, Update, reload → 4 fields incl. email. Form settings: the actions filter shows "no results" for a nonsense query. Global settings: tabs switch. Entries: the 10-column limit note (moved into
entries.js) shows, and with 10 columns checked the remaining checkbox is disabled. - The pages for settings, global settings and import/export wait for
wp.hooksactions added by their page script; those hooks are registered (hasActiontrue) on the matching screens.
Not run / not exercised: a line-by-line read of the moved builder modules (the checks above are mechanical), drag-and-drop, field groups, conditional logic and repeaters in the browser, the real import of an exported XML file, a form actions add/delete round trip, PHPCS/PHPStan, and the review skills (too large for this pass).
Changes
Load builder, form settings, global settings, and import/export JavaScript on their respective screens. The shared production bundle drops from 278 KB to 104 KB. The builder loads 268 KB including the shared bundle.
Split builder code into CommonJS files for field loading, editing, drag-and-drop, previews, choices, groups, and conditional logic. Move entry-column handling into the entries script and reuse WordPress's i18n dependency.
Verification
All 88 JavaScript unit tests passed. Authenticated browser testing on a local WordPress site covered saving and reloading a renamed field, inserting another field, and exporting the test form as XML. The production bundles were rebuilt.
On the same authenticated site, verified the screen-specific script handles on the forms list, builder, form settings, global settings, styles, entries, and import/export. These page loads produced no uncaught JavaScript errors. Saved and reloaded a radio choice, saved a form settings change, and imported the downloaded XML after changing a field label. An independent MCP read confirmed that the import restored the exported value. Deleted the disposable form and verified its removal.
The full Cypress workflow passed on all four shards at commit d8cf622. The live global settings CAPTCHA control and the entries column-limit notice were also verified.
https://github.com/Strategy11/formidable-forms/actions/runs/46048209041