Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34700 closed defect (bug) (fixed)

During installation, only enqueue scripts when necessary

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

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

Download all attachments as: .zip

Change History (14)

@flixos90
11 years ago

this patch only prints the scripts when they're needed

#1 @flixos90
11 years ago

  • Keywords has-patch added

#2 follow-up: @ocean90
11 years ago

  • Milestone Awaiting Review → 4.4

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

Version 0, edited 11 years ago by ocean90 (next)

#3 follow-up: @flixos90
11 years ago

@ocean90 on what form did you find that error?

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


11 years ago

#6 @ocean90
11 years ago

  • Owner set to ocean90
  • Status new → accepted

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

  • Keywords needs-patch added; has-patch removed
  • Milestone 4.4 → Future Release
  • Version trunk → 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
11 years ago

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

#9 @swissspidy
11 years ago

  • Milestone Future Release → 4.5

@ocean90
11 years ago

#10 @ocean90
11 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
11 years ago

  • Resolution → fixed
  • Status accepted → closed

In 36176:

Install: Only enqueue scripts when necessary.

Props flixos90 for initial patch.
Fixes #34700.

Note: See TracTickets for help on using tickets.