• Resolved victorove

    (@victorove)


    ESI doesn’t work with widgets anymore after they were changed to blocks. Editing widgets as blocks doesn’t show option to use ESI for a particular widget.

    After adding code snippet to remove the block-design from widgets in customizer, the ESI option is shown, but changing it has no effect, loading animation appears and nothing happens, it keeps on spinning. The default ESI option, Private, works though.

    When turning debug log there are no errors that would explain it. Is it possible to change it in database directly or something similar?

    Trying to get it to work with “Recently viewed products” widget which was working as expected and now it doesn’t.

    • This topic was modified 3 years, 4 months ago by victorove.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter victorove

    (@victorove)

    Since I cannot edit the original post.

    Edit: We’ve done the standard troubleshooting to exclude plugin conflict and with only LS Cache and WooCommerce turned on it still doesn’t work the way it should. It’s not possible to control ESI option for widgets from customizer, but the default ESI setting for widget works as intended.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    please try edit file /wp-content/plugins/litespeed-cache/src/admin-setting.cls.php

    at bottom of it , you will see a block

    if ( ! $current || $esi != $current[ ESI::WIDGET_O_ESIENABLE ] ) {
    			Purge::purge_all( 'Wdiget ESI_enable changed' ) ;
    		}
    		elseif ( $ttl != 0 && $ttl != $current[ ESI::WIDGET_O_TTL ] ) {
    			Purge::add( Tag::TYPE_WIDGET . $widget->id ) ;
    		}
    
    		Purge::purge_all( 'Wdiget saved' ) ;

    change it to

    
    		if ( ! strpos( $_SERVER[ 'HTTP_REFERER' ], '/wp-admin/customize.php?return=%2Fwp-admin%2F') ) {
        		if ( ! $current || $esi != $current[ ESI::WIDGET_O_ESIENABLE ] ) {
        			Purge::purge_all( 'Wdiget ESI_enable changed' ) ;
        		}
        		elseif ( $ttl != 0 && $ttl != $current[ ESI::WIDGET_O_TTL ] ) {
        			Purge::add( Tag::TYPE_WIDGET . $widget->id ) ;
        		}
        
        		Purge::purge_all( 'Wdiget saved' ) ;
    		}
    		else {
    		    // delay purge_all to the next non-customize-widget-page request
    		    // for temp fix, this is not big issue, leave it for later in official fix
    		}

    this is a temp solution , we will work out a permanent solution

    Best regards,

    Thread Starter victorove

    (@victorove)

    Hi @qtwrk. We have used different workaround and edited the widgets from admin panel (Appearance > widgets), which seems to ignore the caching.

    Outside admin panel it seems LSC ignores the settings related to caching admin, for example links on admin bar work well while in admin area, outside of admin area LSC breaks the links that normally should be accessible.

    PS. It seems there are typos in your code, Wdiget instead of Widget.

    • This reply was modified 3 years, 3 months ago by victorove.

    Hi @victorove

    Thank you for the reporting. The temp fix qtwrk provided above are to fix the widget settings updating issue on the Customize page. Did you give it a try? For wp5.7.4-, this should work well.

    For wp5.8+, indeed there is some more work to do. We are working on this. If you have any findings, we welcome you to report it through tickets here: https://store.litespeedtech.com/store/submitticket.php

    How did you disable the widget block editor? You mentioned “code snippet”. Did you try to use the Classic Widget plugin?

    BTW, yes, you had a good catch of the typo. It has been there so we just leave it there for now.

    Thread Starter victorove

    (@victorove)

    The temp fix qtwrk provided above are to fix the widget settings updating issue on the Customize page. Did you give it a try?

    No, since we solved it changing widgets from admin area there was no need for that fix, besides we are on wp 5.8.2. Current findings are that the caching should be completely disabled for admin and it is not, it’s only disabled in admin area, but once you leave it, everything is cached regardless of the role, thus breaking Customizer and links in admin bar.

    To disable the block editor for widgets we use filters

    add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );
    add_filter( 'use_widgets_block_editor', '__return_false' );

    It’s only two lines of code, so we will not be using plugin for this.

    Ok, basically when you disabled the widget block editor you still had the ESI problem. If that’s the case, please create a ticket from the link I gave above. It’s not supposed to be this way so we may need to check into your site with more specific information.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Customizer not working with ESI enabled’ is closed to new replies.