Problem/Motivation

In the Profile edit form, when we edit an island configuration in a modal, we lose changes from main form when the modal is submiited.

Steps to reproduce

  1. I uncheck a checked island (or similar changes)
  2. I open the dialog of another island config
  3. I save the form inside the dialog, the dialog closes
  4. ❌ The island is checked again

Proposed resolution

Don't reload the full page when submitting a modal form?

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

mogtofu33 created an issue. See original summary.

pdureau’s picture

Please wait #3538440: Merge island_settings & island_configuration in profiles is merged before starting this one

pdureau’s picture

We are closing alpha4 soon

pdureau’s picture

Have the configuration use Drupal ajax when saved

Is it something which will fix this bug?

  1. I uncheck a checked island (or similar changes)
  2. I open the dialog of another island config
  3. I save the form inside the dialog, the dialog closes
  4. ❌ The island is checked again
pdureau’s picture

pdureau’s picture

Beta4 has already been released.

mogtofu33’s picture

Parent issue: » #3576683: [meta] UX refresh
mogtofu33’s picture

Status: Active » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

pdureau’s picture

Status: Closed (outdated) » Active

I am still reproducing this in the Profile configuration:

  1. I uncheck a checked island (or similar changes)
  2. I open the dialog of another island config
  3. I save the form inside the dialog, the dialog closes
  4. ❌ The island is checked again

Is it what you meant with "Have the configuration use Drupal ajax when saved"? If yes, we can update the description to focus on this task.

pdureau’s picture

Title: Island components configuration and tabs » Profile edit form: losing changes when submitting a modal
Issue summary: View changes
Issue tags: +Novice

andres alvarez made their first commit to this issue’s fork.

andres alvarez’s picture

Fixed by wiring #ajax callback on the submit action when the form is opened in a modal. The form now closes via AJAX instead of redirecting, which preserves unsaved changes in the parent ProfileForm.

Without the callback, the browser submits a regular full-page POST that Drupal doesn't recognize as AJAX, so the redirect proceeds and loses the parent form's state. With it, the browser submits via XHR, the entity is saved through the normal chain, and ajaxSubmit() returns a CloseDialogCommand to close the modal without navigation.

Added a FunctionalJavascript test verifying that the modal closes without page reload and parent form changes survive. The test fails as expected if the fix is reverted.

andres alvarez’s picture

Status: Active » Needs review

mogtofu33’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • mogtofu33 committed 10a16fa1 on 1.0.x
    fix: #3539324 form rebuild carrying only its button no longer replaces...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.