Skip to content

Load Formidable admin JavaScript by screen - #3761

Open
Crabcyborg wants to merge 2 commits into
masterfrom
perf/split-admin-page-scripts
Open

Crabcyborg wants to merge 2 commits into
masterfrom
perf/split-admin-page-scripts

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2a91b45 and d8cf622.

Files selected for processing: 37

  • .oxlintrc.json
  • classes/controllers/FrmAppController.php
  • eslint.config.mjs
  • js/admin/entries.js
  • js/formidable-form-settings.js
  • js/formidable-global-settings.js
  • js/formidable-import-export.js
  • js/formidable_admin.js
  • js/formidable_builder.js
  • js/frm_testing_mode.js
  • js/src/admin/addon-state.js
  • js/src/admin/admin.js
  • js/src/admin/builder.js
  • js/src/admin/builder/conditionalLogic.js
  • js/src/admin/builder/dragDrop.js
  • js/src/admin/builder/fieldActions.js
  • js/src/admin/builder/fieldEditor.js
  • js/src/admin/builder/fieldGroups.js
  • js/src/admin/builder/fieldLoading.js
  • js/src/admin/builder/fieldOptions.js
  • js/src/admin/builder/fieldPreview.js
  • js/src/admin/calculationFields.js
  • js/src/admin/fieldChoices.js
  • js/src/admin/fieldLayout.js
  • js/src/admin/fieldPreviewSelectors.js
  • js/src/admin/fieldPreviews.js
  • js/src/admin/form-settings.js
  • js/src/admin/formActions.js
  • js/src/admin/global-settings.js
  • js/src/admin/import-export.js
  • js/src/admin/license.js
  • js/src/admin/search.js
  • js/src/admin/settings/validateRangeSettings.js
  • js/src/admin/shortcodes.js
  • js/src/admin/upgrade-popup.js
  • js/src/admin/upgradeDialogs.js
  • webpack.config.js
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@Crabcyborg Crabcyborg added the run e2e tests Run the Cypress end-to-end suite on this PR label Nov 27, 2026
@Crabcyborg Crabcyborg added priority: high franky-review and removed run e2e tests Run the Cypress end-to-end suite on this PR labels Nov 27, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 27, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mjs at d8cf622 → 88 pass, 0 fail. CI skips the JS unit job on this PR, so this run is the only one.
  • ESLint over js/src/admin and js/formidable_builder.js: zero no-undef hits, so no identifier lost its definition in the move. The only errors are three "rule not found" for sonarjs rules missing from my local node_modules, on lines that master already has.
  • Rebuilt with NODE_ENV=production webpack and 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 new js/*.js.LICENSE.txt are 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/src files, the 426 that no longer appear anywhere are mostly state variables now read as builder.state.*, frmDom destructuring and the require lines. 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.buildInit and insertFormField exist only on the builder, infoModal everywhere. 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.hooks actions added by their page script; those hooks are registered (hasAction true) 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).

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant