Make WordPress Core

Changeset 50766


Ignore:
Timestamp:
04/17/2021 11:27:35 AM (3 years ago)
Author:
Clorith
Message:

Site Health: Remove Ajax requests from dashboard widget.

The Site Health dashboard widget uses the same JavaScript file as the Site Health pages to generate its progress indicator.

This file was also set up to store the current Site Health check results if the current tab being shown isn't the debug information one, this had the side effect of the dashboard being seen as not the debug screen as well.

This now has a conditional making sure it's the status screen it self being displayed, before trying to do any Ajax requests.

Props arena.
Fixes #49814.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/site-health.js

    r50764 r50766  
    1313        sprintf = wp.i18n.sprintf,
    1414        clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' ),
     15        isStatusTab = $( '.health-check-body.health-check-status-tab' ).length,
    1516        isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length,
    1617        pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ),
     
    230231        }
    231232
    232         if ( ! isDebugTab ) {
     233        if ( isStatusTab ) {
    233234            $.post(
    234235                ajaxurl,
     
    347348    }
    348349
    349     if ( 'undefined' !== typeof SiteHealth && ! isDebugTab ) {
     350    if ( 'undefined' !== typeof SiteHealth ) {
    350351        if ( 0 === SiteHealth.site_status.direct.length && 0 === SiteHealth.site_status.async.length ) {
    351352            recalculateProgression();
  • trunk/src/wp-admin/site-health.php

    r50765 r50766  
    196196</div>
    197197
    198 <div class="health-check-body hide-if-no-js">
     198<div class="health-check-body health-check-status-tab hide-if-no-js">
    199199    <div class="site-status-all-clear hide">
    200200        <p class="icon">
Note: See TracChangeset for help on using the changeset viewer.