Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-5392

Changes to the UI when toggling features not reflected in WP menu after save, requires additional refresh

    XporterXMLWordPrintable

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Should have
    • Resolution: Released
    • Affects Version/s: None
    • Fix Version/s: 2.37.0
    • Labels:
      None
    • Story Points:
      2
    • Sprint:
      Sprint #142
    • Section:
      Admin Panel
    • Track:
      Development
    • Release Notes excerpt:
      Hide
      We recently introduced a new menu where you can toggle certain experimental features. Some of these features might add some menu items in the WordPress backend when turned on. Because of how CMB2 (library we use for the settings pages) works, the WordPress menu is rendered before the saved settings are processed. For this menu this meant the expected menu items, for the features that were just turned on, would not appear until you refresh the page. As a workaround we added a script to do this refresh for you.
      Show
      We recently introduced a new menu where you can toggle certain experimental features. Some of these features might add some menu items in the WordPress backend when turned on. Because of how CMB2 (library we use for the settings pages) works, the WordPress menu is rendered before the saved settings are processed. For this menu this meant the expected menu items, for the features that were just turned on, would not appear until you refresh the page. As a workaround we added a script to do this refresh for you.
    • Repositories:
      planet4-master-theme

      Description

      We added a WordPress option page to toggle features (e.g. for https://jira.greenpeace.org/browse/PLANET-5189). These features can affect which menu items are shown in the backend. However because of how WordPress processes these changes, the WordPress admin menu is rendered before the setting change is processed. So the page you see after saving does not reflect the current settings and you need to refresh the page again to see the new feature settings reflected in the menu.

      Example (test instance of other ticket which triggers the issue) https://k8s.p4.greenpeace.org/test-deimos/wp-admin/admin.php?page=planet4_settings_features 
      If you toggle the "Image Archive" option, you initially don't see changes to the WP menu but you do after refreshing.

      Proposed solution: We could set up something that forces a redirect after the settings were saved, but only for the "/wp-admin/admin.php?page=planet4_settings_features" page as this does increase the page load time.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                pvincent Pieter Vincent
                Reporter:
                pvincent Pieter Vincent
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: