WordPress.org

Make WordPress Core

Opened 7 days ago

Last modified 6 hours ago

#42184 reviewing defect (bug)

Customizer theme install getting stuck on downloading

Reported by: helen Owned by: celloexpressions
Milestone: 4.9 Priority: normal
Severity: normal Version: trunk
Component: Customize Keywords: needs-patch
Focuses: Cc:

Description

I've been getting into situations with the new theme browser/installer in the customizer where it gets stuck on the downloading spinner or the install button doesn't actually work at all - you can click it but nothing happens, and no errors in the console.

I *think* this has to do with the fact that I'm also messing around with forcing the FTP credential prompt for other purposes and toggling that on and off in PHP without reloading the page. This itself may (probably) be an edge case that doesn't need addressing, but I think the error handling could be better and may come up in other situations.

Steps to reproduce:

  1. Browse .org themes in the customizer.
  2. With forced FTP on (will add code for this in a followup comment), attempt to "install and preview" from the grid view.
  3. Observe that failure notice appears over the screenshot and button changes to Installation failed but remains primary and active
  4. Disable forcing FTP in PHP elsewhere; do not reload page.
  5. Button on the attempted theme is still clickable but does nothing, all other buttons will take you to the downloading spinner which never completes.

Attachments (3)

42184.0.diff (663 bytes) - added by westonruter 6 days ago.
credential-modal.png (303.0 KB) - added by westonruter 3 days ago.
after-credential-modal-cancel.png (224.3 KB) - added by westonruter 3 days ago.

Download all attachments as: .zip

Change History (13)

#1 @helen
7 days ago

@ocean90's plugin code for forcing FTP:

<?php
/**
 * Plugin Name: Force FTP
 * Description: Used to test FTP credentials screen.
 */

add_filter( 'filesystem_method', function() {
        return 'ftpext';
} );

add_filter( 'fs_ftp_connection_types', function() {
        return [
                'ftp'  => __( 'FTP' ),
                'ftps' => __( 'FTPS (SSL)' ),
                'ssh'  => __( 'SSH2' ),
        ];
} );
Last edited 7 days ago by westonruter (previous) (diff)

#2 @westonruter
7 days ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.9

I was able to reproduce this a couple times when I was hacking around trying to force an unable_to_connect_to_filesystem error when calling wp_ajax_install_theme(). I think it has something to do with wp.updates.maybeRequestFilesystemCredentials(), and the wp.updates.ajaxLocked and wp.updates.shouldRequestFilesystemCredentials flags. I think it assumes a prompt is being shown to enter credentials, but I've never seen this appear. Maybe it is actually being shown but it is hidden behind the Customizer UI thanks to z-index issues?

#3 @celloexpressions
7 days ago

My expectation has been that the calls to wp.updates in the themes panel JS (and also maybe in the section JS) would show the filesystem credentials and handle related errors (with the adjustments to updates.js in #37661). It would be most helpful if the people who worked on shiny updates (I think @obenland or @swissspidy, possibly others?) could take a look at how it's being applied to the customizer. My guess is that the required error handling and credential overlays are mostly implemented but require minor tweaking to be fully functional in this context.

#4 @obenland
6 days ago

This seems to be an issue of a missing wp_print_request_filesystem_credentials_modal(); call in wp-admin/customize.php to capture FTP credentials. Once that was added, the theme browser should also listen for when the modal closes prematurely and return to the selection instead of the loading spinner.

@westonruter
6 days ago

#5 @westonruter
6 days ago

  • Keywords has-patch added; needs-patch removed

@obenland thanks for that! That makes sense. @helen Would you test 42184.0.diff to see if it fixes the issue you reported?

Note that you'll need to have that plugin active to force FTP mode before loading the Customizer, since the template will skip rendering if it detects it has direct write access to the filesystem. You wouldn't be able test with dynamically enabling/disabling FTP mode while the Customizer is open.

#6 @westonruter
5 days ago

  • Owner set to helen
  • Status changed from new to reviewing

#7 @westonruter
5 days ago

I just noticed #42205 (FTP credentials dialog gets hidden behind things) which seems closely related.

#8 @westonruter
3 days ago

  • Keywords needs-patch added; has-patch removed
  • Owner changed from helen to celloexpressions

The problem is going deeper than just adding the credential modal template in 42184.0.diff. When I add it, I do get the modal as expected in credential-modal.png. But when I cancel out of that modal, I then get some weird behavior as can be seen in after-credential-modal-cancel.png.

I think it may have to do with this credential-modal-cancel event handler running in the unexpected context of the Customizer: https://github.com/WordPress/wordpress-develop/blob/850db3c6a05af31efdd4ec982536cae4c496ae61/src/wp-admin/js/updates.js#L1780-L1825

In addition the buttons both getting the “Install” label, then when I try clicking on them they do nothing.

This ticket was mentioned in Slack in #core by melchoyce. View the logs.


2 days ago

This ticket was mentioned in Slack in #core by westonruter. View the logs.


6 hours ago

Note: See TracTickets for help on using tickets.