Outdated tempstore page status causing unwanted enabled/disabled change.

Created on 14 September 2023, over 1 year ago
Updated 14 August 2024, 5 months ago

Problem/Motivation

In some scenarios, the status value (enabled/disabled) is becoming outdated in the page's tempstore, which can cause a status reversal after editing and saving the page immediately after a status change.

Steps to reproduce

  1. Edit and save a page to ensure it has a tempstore created.
  2. In the page listing, enable it (or if it is already enabled, disable it).
  3. Edit this same page again and save.
  4. When returning to the page listing, the status will revert to the status before step 2.

Proposed resolution

Clear the tempstore of this page when the status is changed by the listing, within the PageManagerController::performPageOperation method:

...
    $page->$op()->save();

    // Clear the page tempstore to avoid having an outdated status when editing the form.
    $pageManagerTempstore = $this->tempstore->get('page_manager.page');

    if ($pageManagerTempstore->get($page->id())) {
      $pageManagerTempstore->delete($page->id());
    }

    if ($op == 'enable') {
...

Remaining tasks

Check unit tests and fix if something is broken

🐛 Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024