WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#34700 closed defect (bug) (fixed)

During installation, only enqueue scripts when necessary

Reported by: flixos90 Owned by: ocean90
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.3
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

The JS files enqueued during the installation routine are included in all the steps although they are not required in each one. This also creates some JS errors in the console.

Attachments (3)

34700.diff (785 bytes) - added by flixos90 6 years ago.
this patch only prints the scripts when they're needed
34700.2.diff (1.2 KB) - added by flixos90 6 years ago.
34700.3.diff (1.5 KB) - added by ocean90 6 years ago.

Download all attachments as: .zip

Change History (14)

@flixos90
6 years ago

this patch only prints the scripts when they're needed

#1 @flixos90
6 years ago

  • Keywords has-patch added

#2 follow-up: @ocean90
6 years ago

  • Milestone changed from Awaiting Review to 4.4

This also creates some JS errors in the console.

user-profile.js?ver=4.4-beta4-35625-src-1447703485:202 Uncaught TypeError: Cannot read property 'prop' of undefined
Last edited 6 years ago by ocean90 (previous) (diff)

#3 follow-up: @flixos90
6 years ago

@ocean90 on what form did you find that error?

#4 in reply to: ↑ 3 @ocean90
6 years ago

Replying to flixos90:
Sry, that should have been a reply to your "This also creates some JS errors" note.

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


6 years ago

#6 @ocean90
6 years ago

  • Owner set to ocean90
  • Status changed from new to accepted

#7 in reply to: ↑ 2 ; follow-up: @ocean90
6 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 4.4 to Future Release
  • Version changed from trunk to 4.3

Replying to ocean90:

This also creates some JS errors in the console.

user-profile.js?ver=4.4-beta4-35625-src-1447703485:202 Uncaught TypeError: Cannot read property 'prop' of undefined

The error is gone with [35649].

34700.diff doesn't work always, because the first step can be 0 or 1: // Deliberately fall through if we can't reach the translations API.

@flixos90
6 years ago

#8 in reply to: ↑ 7 @flixos90
6 years ago

  • Keywords has-patch added; needs-patch removed

Replying to ocean90:

34700.diff doesn't work always, because the first step can be 0 or 1: // Deliberately fall through if we can't reach the translations API.

34700.2.diff should fix it.

Last edited 6 years ago by flixos90 (previous) (diff)

#9 @swissspidy
6 years ago

  • Milestone changed from Future Release to 4.5

@ocean90
6 years ago

#10 @ocean90
6 years ago

@flixos90 Step 2 needs the user-profile script too because it also shows the display_setup_form() in case of errors.

Since wp_print_scripts() supports an array we can build a list of scripts to enqueue, see 34700.3.diff.

#11 @ocean90
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 36176:

Install: Only enqueue scripts when necessary.

Props flixos90 for initial patch.
Fixes #34700.

Note: See TracTickets for help on using tickets.