Problem/Motivation

`ContentExportForm::buildForm()` runs the full export on every page load just to fill the "Exported content" preview. That value is then thrown away, as both submit handlers call `doExportToYml()` again, so opening the page and downloading exports the entity twice. If a user does not copy the preview and instead downloads the file, the whole preview build is wasted. On heavily referenced content, the preview can also become extremely slow.

Proposed resolution

Add a new setting, "Build the content preview on demand" (off by default, so nothing changes for existing sites). When it is on, the export page renders a "Show exported content" button in place of the field and never calls `doExportToYml()` on load. Pressing the button swaps the field in over AJAX. Ace is no longer loaded on page load either. Downloads are untouched.

Remaining tasks

User interface changes

API changes

With the setting on and no preview requested, `$form['output']` is a container rather than a textarea.

Data model changes

New config `single_content_sync.settings:export_preview_on_demand` (boolean, default `FALSE`).

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alex.bukach created an issue. See original summary.

alex.bukach’s picture

Assigned: alex.bukach » Unassigned
Status: Active » Needs review