Page MenuHomePhabricator

Start deprecation process to discourage use of various frontend ResourceLoader JS modules
Closed, ResolvedPublic

Description

We now have the ability to warn developers about using certain modules that we'd rather get rid of from our infrastructure.

I've suggested several modules to start off with:

  • jquery.jStorage
  • jquery.ui
  • jquery.ui.widget
  • jquery.effects.core
  • jquery.ui.position

It would be good to discuss this in the frontend standards group (adding/removing modules from that patch) and merging swiftly after the meeting.

Event Timeline

Change 302732 had a related patch set uploaded (by Jdlrobson):
Deprecate various ResourceLoader modules

https://gerrit.wikimedia.org/r/302732

Change 302732 merged by jenkins-bot:
Deprecate various ResourceLoader modules

https://gerrit.wikimedia.org/r/302732

Jdlrobson reopened this task as Open.EditedAug 15 2016, 5:09 PM

I'm not seeing deprecation notices for any of the following... any ideas why?
All the others work fine.

mw.loader.using( 'jquery.ui.core' )
mw.loader.using( 'jquery.ui.widget' )

I'm not seeing deprecation notices for any of the following... any ideas why?
All the others work fine.

mw.loader.using( 'jquery.ui.core' )
mw.loader.using( 'jquery.ui.widget' )

I'm getting them on e.g. https://en.wikipedia.beta.wmflabs.org/wiki/User:Jdforrester_(WMF)/sandbox (incognito) via TimedMediaHandler.

Change 305047 had a related patch set uploaded (by Jdlrobson):
Start deprecation process for jQuery.appear

https://gerrit.wikimedia.org/r/305047

So it looks like jquery.ui.position is not deprecated. Is this is an oversight or not? If it is deprecated, what is the replacement for it?

Hi @Nikerabbit jquery.ui.core is deprecated so anything that depends on that (jquery.ui.position included) is deprecated. I'll have to remind myself of the module to find a suitable replacement.

jquery.ui.position does not have any dependencies.

Hi apologies I forgot to hit send.

jquery.ui.position is in the group jquery.ui so should have the same deprecation process as jquery.ui.core - although for some reason I'm not seeing warning messages.

I'm not too familiar with how groups work. @Krinkle why does jquery.ui.position not trigger a load for the dependency jquery.ui.core ? Do we need to factor in groups into the deprecation process?

@Jdlrobson No, groups aren't relevant here. See https://www.mediawiki.org/wiki/ResourceLoader/Features#Groups. Groups inform mw.loader that any load.php request for those module(s) should have their own HTTP request, rather than being batched together with other modules. This is to fine-tune cache hits.

jquery.ui.position doesn't trigger a load for jquery.ui.core because it shouldn't. It doesn't depend on it. Modules jquery.ui.widget and jquery.effects.core don't depend on it, either.

The other ui and effects modules all depend on 1 or more others, so we didn't mark them as deprecated to reduce noise. But jquery.ui.position should still be marked as deprecated directly.

Can we have separate tasks for individual modules (or groups of modules) please?

Change 306859 had a related patch set (by Jforrester) published:
jquery.ui.position: Mark as deprecated

https://gerrit.wikimedia.org/r/306859

Can we have separate tasks for individual modules (or groups of modules) please?

Yes, and this task is meant to only be for marking the first few (jquery.jStorage, jquery.ui, jquery.ui.widget jquery.effects.core, and jquery.ui.position). Everything else (including jQuery.appear) should go through its own task/process/whatever.

Change 306859 merged by jenkins-bot:
jquery.ui.position: Mark as deprecated

https://gerrit.wikimedia.org/r/306859

Jdforrester-WMF reassigned this task from Jdforrester-WMF to Jdlrobson.
Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF edited projects, added JavaScript; removed Patch-For-Review.
Jdforrester-WMF updated the task description. (Show Details)

So it looks like jquery.ui.position is not deprecated. Is this is an oversight or not? If it is deprecated, what is the replacement for it?

The second question is still unanswered.

Not everything is as simple as "use this instead". It might be better achieved via thinking differently about the problem, another library (e.g. using a ready made OOUI widget) or some code specific to your extension.

I would suggest creating a task capturing how you are using jquery.ui.position and we can take it from there. As @Legoktm suggests I think we can create separate tickets for new deprecated modules and for rethinking existing deprecations. Please tag ResourceLoader and Frontend standards group on the new ticket.