Make WordPress Core

Opened 5 months ago

Closed 4 months ago

#64429 closed defect (bug) (fixed)

Script Modules: Dependencies inherit fetchpriority from not-enqueued, registered modules

Reported by: jonsurrell's profile jonsurrell Owned by: westonruter's profile westonruter
Milestone: 6.9.1 Priority: normal
Severity: normal Version: 6.9
Component: Script Loader Keywords: has-patch has-unit-tests fixed-major
Focuses: javascript Cc:

Description (last modified by westonruter)

In PR 10638 (comment), it was noticed that a script module's fetchpriority may increased to match its dependent's fetchpriority even if that module is not enqueued.

It seems that the dependency's fetchpriority should only increase when an enqueued dependent has a higher fetchpriority, not when any registered dependent has a higher fetchpriority.

[60931] added the logic for module dependencies to increase their fetch priority.

Change History (13)

#1 @jonsurrell
5 months ago

@westonruter Do you recall if this was the expected behavior?

This ticket was mentioned in PR #10651 on WordPress/wordpress-develop by @westonruter.


5 months ago
#2

  • Keywords has-patch has-unit-tests added

#3 @westonruter
5 months ago

  • Milestone changed from Awaiting Review to 7.0
  • Owner set to westonruter
  • Status changed from new to accepted
  • Version set to 6.9

No, this is not expected. Working on a fix.

#4 @westonruter
5 months ago

When WP_Script_Modules::print_script_module() was calculating the highest fetchpriority for its script module dependents, it was not considering whether those dependents were actually enqueued. Now it does.

Note the issue was not present for classic scripts.

Test cases have been added for scripts and script modules.

Ready for review: https://github.com/WordPress/wordpress-develop/pull/10651

#5 @jonsurrell
5 months ago

This isn't a critical issue but it was introduced in 6.9 and could be considered for a 6.9.x patch release.

#6 @westonruter
5 months ago

  • Milestone changed from 7.0 to 6.9.1

#7 @westonruter
5 months ago

  • Description modified (diff)

#8 @westonruter
5 months ago

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

In 61401:

Script Loader: Fix script module fetchpriority calculation when dependent with higher priority is not enqueued.

Developed in https://github.com/WordPress/wordpress-develop/pull/10651

Follow-up to [60931], [60704].

Props westonruter, jonsurrell, youknowriad.
See #61734.
Fixes #64429.

#9 @westonruter
5 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening for 6.9 backport consideration.

#10 @jonsurrell
5 months ago

  • Keywords dev-feedback added

#11 @jonsurrell
4 months ago

  • Keywords dev-feedback removed

[61401] looks good for 6.9 backport.

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


4 months ago

#13 @jonsurrell
4 months ago

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

In 61506:

Script Loader: Fix script module fetchpriority calculation when dependent with higher priority is not enqueued.

Developed in https://github.com/WordPress/wordpress-develop/pull/10651

Follow-up to [60931], [60704].

Reviewed by jonsurrell.
Merges [61401] to the 6.9 branch.

Props westonruter, jonsurrell, youknowriad.
Fixes #64429. See #61734.

Note: See TracTickets for help on using tickets.