Skip to content

Defer when field settings HTML is added to page - #3532

Merged
Crabcyborg merged 1 commit into
masterfrom
defer_when_field_settings_html_is_added_to_page
Oct 2, 2026
Merged

Crabcyborg merged 1 commit into
masterfrom
defer_when_field_settings_html_is_added_to_page

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Measurement Before After Difference
AJAX HTML inserted into DOM 38.45 MB 2.43 MB 93.7% less
AJAX field DOM elements 644,280 37,041 94.3% fewer
40-field DOM insertion simulation 1,410 ms 83 ms 94.1% faster
One-field save preparation simulation 10.55 ms 1.72 ms 83.7% faster
Aggregate PHP rendering 5,990 ms 5,987 ms Essentially unchanged
Compressed AJAX responses 4.49 MB 4.53 MB 0.8% larger

@coderabbitai

coderabbitai Bot commented Oct 2, 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 2 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

Configuration used: Repository: Strategy11/formidable-forms/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 7649b2eb-0b92-4a28-9e76-eeae0c4d98e0

📥 Commits

Reviewing files that changed from the base of the PR and between 0db2e17 and dec174e.

📒 Files selected for processing (8)
  • classes/controllers/FrmFieldsController.php
  • classes/views/frm-forms/add_field.php
  • js/formidable_admin.js
  • js/src/admin/admin.js
  • js/src/admin/deferredFieldSettings.js
  • tests/phpunit/fields/test_FrmFieldsAjax.php
  • tests/phpunit/fields/test_FrmFieldsController.php
  • tests/phpunit/forms/test_FrmForm.php
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Oct 2, 2026
@deepsource-io

deepsource-io Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 0db2e17...dec174e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Oct 2, 2026 9:35p.m. Review ↗
JavaScript Oct 2, 2026 9:35p.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.

FrmFieldsController::load_single_field( $field, array( 'doing_ajax' => true ) );
$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );
$this->assertStringNotContainsString( 'frm-deferred-settings-meta', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringNotContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

)
);

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.


$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );
$this->assertSame( $before->default_value, $after->default_value );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 12, (int) $settings->meta['order'] );
$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );
$this->assertStringContainsString( 'name="field_options[type_' . $field->id . ']"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

FrmFieldsController::load_single_field( $field, array( 'doing_ajax' => true ) );
$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );
$this->assertStringNotContainsString( 'frm-deferred-settings-meta', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringNotContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

)
);

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.


$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );
$this->assertSame( $before->default_value, $after->default_value );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 12, (int) $settings->meta['order'] );
$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );
$this->assertStringContainsString( 'name="field_options[type_' . $field->id . ']"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

FrmFieldsController::load_single_field( $field, array( 'doing_ajax' => true ) );
$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );
$this->assertStringNotContainsString( 'frm-deferred-settings-meta', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringNotContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

)
);

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.


$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );
$this->assertSame( $before->default_value, $after->default_value );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 12, (int) $settings->meta['order'] );
$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );
$this->assertStringContainsString( 'name="field_options[type_' . $field->id . ']"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

FrmFieldsController::load_single_field( $field, array( 'doing_ajax' => true ) );
$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$html = ob_get_clean();

$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $html );
$this->assertStringNotContainsString( 'frm-deferred-settings-meta', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringNotContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

)
);

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.


$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'Changed field', FrmField::getOne( $edited->id )->name );
$after = FrmField::getOne( $untouched->id );
$this->assertSame( $before->name, $after->name );
$this->assertSame( $before->default_value, $after->default_value );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmForm::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 12, (int) $settings->meta['order'] );
$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( 'frm_half custom_class', $settings->meta['classes'] );
$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->name, $settings->meta['name'] );
$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $type, $settings->meta['type'] );
$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertSame( $field->field_key, $settings->meta['key'] );
$this->assertStringContainsString( 'id="frm-single-settings-' . $field->id . '"', $settings->html );
$this->assertStringContainsString( 'name="frm_fields_submitted[]"', $settings->html );
$this->assertStringContainsString( 'name="field_options[type_' . $field->id . ']"', $settings->html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmFieldsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

@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 with two non-blocking performance notes. I found no correctness regression.

Live-tested on this PR's branch (preview env, "Big builder test" form, 37 fields, 26 deferred):

  • Builder loads with 26 .frm-deferred-settings-meta containers and 13 settings panels (the rest are deferred).
  • Click on a deferred radio field materializes its panel; inputs are correct and the preview and name stay in sync.
  • Edit a label on a deferred field, Duplicate another, then Save: reload showed the edit and the copy persisted, every other field kept its name, type and order, and there were no duplicate field keys.
  • After reload I opened all 37 fields: each had its settings, name matching its preview label, and options present on radio/checkbox/select. No console errors.
  • Delete a field that was duplicated and materialized: preview and settings both gone, no stray _<id>] inputs left to submit.

Not exercised, so not claimed:

  • Drag/drop reorder and the layout-class (field group) path. I could not drive the sortable with synthetic mouse events here, so these are source-read only.
  • The new PHPUnit tests: CI skipped PHPUnit/PHPStan/PHPCS on this head, and I did not run them locally.
  • Pro and add-on JS against the deferred types. I read Pro's builder.js: it guards on missing settings for the slider code, and its frm_ajax_loaded_field listener only handles RTE, which is not deferred.

Two notes, inline below:

  1. One option delete materializes every pending panel (verified live: 13 to 39 panels).
  2. A reorder materializes every field whose index shifted (source-read).

Comment thread js/src/admin/admin.js
* Delete a field option.
*/
function deleteFieldOption() {
materializeAllFieldSettings( prepareLoadedFieldMarkup );

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.

Non-blocking, verified live: deleting a single option on a loaded field runs materializeAllFieldSettings() and inserts every pending panel. On the 37-field test form that took the settings count from 13 to 39 (about 160 ms). On a 150-field form most of the deferral is lost the first time anyone edits or deletes a choice. The same call is added at line 6437 and in adjustConditionalLogicOptionOrders (line 7132).

Only fields that have logic rows pointing at the changed field need their panel. A cheap guard would be to skip the call unless some pending panel could contain a .frm_logic_row, or to track which field IDs have logic rows in the preview metadata.

Comment thread js/src/admin/admin.js
if ( currentOrder != newOrder && null !== currentOrder ) {
field.value = newOrder;
singleField = fields[ i ].querySelector( `#frm-single-settings-${ fieldId }` );
singleField = ensureFieldSettings( fieldId );

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.

Non-blocking, source-read (I could not drive a drag live): ensureFieldSettings( fieldId ) here runs for every field whose index shifted. Dropping or inserting a field near the top of a long form shifts almost every field after it, so one drag materializes all of them in one synchronous loop. Only the order input has to reach the save form, and the metadata field_order_<id> input already carries it. Moving that input into the form, and leaving the panel deferred, would keep reorder cheap.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Oct 2, 2026
@Crabcyborg
Crabcyborg merged commit 98df20b into master Oct 2, 2026
58 of 59 checks passed
@Crabcyborg
Crabcyborg deleted the defer_when_field_settings_html_is_added_to_page branch October 2, 2026 23:47
@Crabcyborg
Crabcyborg restored the defer_when_field_settings_html_is_added_to_page branch October 2, 2026 23:47
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