Page MenuHomePhabricator

Deprecate jquery.throttle-debounce in favour of (mw.util|OO.ui).debounce/throttle
Open, LowPublic

Description

Timeline:

Details

ProjectBranchLines +/-Subject
mediawiki/extensions/ExternalGuidancemaster+2 -1
mediawiki/extensions/3Dmaster+3 -2
mediawiki/extensions/Translatemaster+46 -5
mediawiki/extensions/MultimediaViewermaster+8 -9
mediawiki/coremaster+3 -3
mediawiki/coremaster+40 -0
mediawiki/coremaster+99 -22
mediawiki/extensions/Graphmaster+3 -3
mediawiki/extensions/InputBoxmaster+2 -2
mediawiki/extensions/Wikibasemaster+2 -4
mediawiki/extensions/WikidataPageBannermaster+2 -2
mediawiki/extensions/Kartographermaster+2 -2
mediawiki/extensions/RelatedArticlesmaster+2 -2
mediawiki/coremaster+48 -9
mediawiki/skins/Vectormaster+4 -4
mediawiki/coremaster+0 -1
mediawiki/coremaster+9 -4
mediawiki/coremaster+0 -4
mediawiki/coremaster+4 -0
Show related patches Customize query in gerrit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 545919 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/RelatedArticles@master] Use mw.util.debounce

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

Jdlrobson removed a project: MobileFrontend.

Moved MobileFrontend to subtask.

Change 545919 merged by jenkins-bot:
[mediawiki/extensions/RelatedArticles@master] Use mw.util.debounce

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

Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)

Change 579705 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/Kartographer@master] Use mw.util.debounce

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

Change 579705 merged by jenkins-bot:
[mediawiki/extensions/Kartographer@master] Use mw.util.debounce

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

I have added a code comment on the Gerrit patch.

Shouldn't
mw.util.debounce.apply( $, arguments );
rather be
mw.util.debounce.apply( mw.util, arguments );

@Od1n good point. practically doesn't matter, because it doesn't use that context, but i've tidied that up.

It doesn't seem like this is going to be done by 1.35? Should the hash tag be released or are we planning to backport those changes?

Change 664228 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/Wikibase@master] Use ooui debounce and throttle instead of deprecated jquery one

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

Change 664229 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/WikidataPageBanner@master] Remove usage of deprecated jquery.throttle-debounce module

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

So, with https://gerrit.wikimedia.org/r/664228 the simple EventSingletonManager utility gets a dependency on the heavy and unrelated OOUI…

As more, this dependency isn't enforced, i.e. all codes that require() this module should make sure OOUI is loaded, and nothing states nor enforces this.

So, with https://gerrit.wikimedia.org/r/664228 the simple EventSingletonManager utility gets a dependency on the heavy and unrelated OOUI…

The whole RL module is depending on ooui already so it's guaranteed to be loaded before this file is executed

As more, this dependency isn't enforced, i.e. all codes that require() this module should make sure OOUI is loaded, and nothing states nor enforces this.

it gets enforced through resource loader

Change 664229 merged by jenkins-bot:
[mediawiki/extensions/WikidataPageBanner@master] Remove usage of deprecated jquery.throttle-debounce module

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

Change 664228 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Use ooui debounce and throttle instead of deprecated jquery one

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

Change 682998 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/extensions/Translate@master] Replace deprecated jQuery.throttle/debounce

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

Change 683034 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/extensions/InputBox@master] Replace deprecated jQuery.debounce

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

Change 683039 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/extensions/MultimediaViewer@master] Replace deprecated jQuery.throttle/debounce

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

Change 683034 merged by jenkins-bot:

[mediawiki/extensions/InputBox@master] Replace use of deprecated $.debounce()

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

Change 684059 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/core@master] Replace use of deprecated $.debounce()

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

I’ve done a few patches, and I find OOUI is quite heavy if used only for the function throttle or “debounce with immediate execution” (mw.util.debounce executes after the delay, not before).

The “immediate debounce” is needed in mediawiki.page.gallery and the throttle is needed in Translate and MobileFrontend. It can be used inline versions, but I’m moderately enthusiastic about that because of code duplication -- it is always a question of balance between maintainability and performance as already said above.

Change 756128 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/Graph@master] Replace jquery.debounce with OO.ui.debounce

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

Change 756128 merged by jenkins-bot:

[mediawiki/extensions/Graph@master] Replace jquery.debounce with OO.ui.debounce

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

It would've been nice to use the same function signature as OOUI, now we have

OO.ui.debounce( callback, wait [, immediate] );
//and
mw.util.debounce( wait, callback );

(ContentTranslation's utils also uses callback, wait, immedate as ported from the same source as underscore.js)

Given we know that the arguments have to be number and Function it's not too late to "fix" it with some type checks (and deprecating the old signature).

It would also be sensible to add the immediate arg, as it is generally useful (e.g. https://gerrit.wikimedia.org/r/c/mediawiki/core/+/684059/)

nb jQuery.throttle also had an immediate arg, but put it in the middle just to be difficult: delay [, at_begin ], callback

Change 759748 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] mw.util.debounce: Use same implementation as OO.ui.debounce

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

Change 759748 merged by jenkins-bot:

[mediawiki/core@master] mediawik.util: Use same debounce implementation as OO.ui.debounce

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

Change 760584 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] mw.util: Add throttle function, ported from OOUI

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

Change 760584 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.util: Add throttle function, ported from OOUI

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

Change 684059 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.page.gallery: Replace use of deprecated $.debounce()

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

Esanders renamed this task from Deprecate jquery.throttle-debounce in favour of mw.util.debounce or OO.ui.debounce/throttle to Deprecate jquery.throttle-debounce in favour of (mw.util|OO.ui).debounce/throttle.Feb 8 2022, 12:53 PM

Change 683039 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Replace deprecated jQuery.throttle/debounce

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

Change 682998 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Replace deprecated jQuery.throttle/debounce

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

Change 773381 had a related patch set uploaded (by Dylsss; author: Dylsss):

[mediawiki/extensions/3D@master] Replace use of deprecated jQuery.debounce

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

Change 773381 merged by jenkins-bot:

[mediawiki/extensions/3D@master] Replace use of deprecated jQuery.debounce

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

Change 795632 had a related patch set uploaded (by Ori; author: Ori):

[mediawiki/extensions/ExternalGuidance@master] mw.externalguidance.special: replace use of deprecated $.debounce

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

Change 795632 merged by jenkins-bot:

[mediawiki/extensions/ExternalGuidance@master] mw.externalguidance.special: replace use of deprecated $.debounce

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