Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#34700 closed defect (bug) (fixed)

During installation, only enqueue scripts when necessary

Reported by: flixos90's profile flixos90 Owned by: ocean90's profile 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 10 years ago.
this patch only prints the scripts when they're needed
34700.2.diff (1.2 KB) - added by flixos90 10 years ago.
34700.3.diff (1.5 KB) - added by ocean90 10 years ago.

Download all attachments as: .zip

Change History (14)

@flixos90
10 years ago

this patch only prints the scripts when they're needed

#1 @flixos90
10 years ago

  • Keywords has-patch added

#2 follow-up: @ocean90
10 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 10 years ago by ocean90 (previous) (diff)

#3 follow-up: @flixos90
10 years ago

@ocean90 on what form did you find that error?

#4 in reply to: ↑ 3 @ocean90
10 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.


10 years ago

#6 @ocean90
10 years ago

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

#7 in reply to: ↑ 2 ; follow-up: @ocean90
10 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
10 years ago

#8 in reply to: ↑ 7 @flixos90
10 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 10 years ago by flixos90 (previous) (diff)

#9 @swissspidy
10 years ago

  • Milestone changed from Future Release to 4.5

@ocean90
10 years ago

#10 @ocean90
10 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
10 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.