Page MenuHomePhabricator

OO.ui.throttle should always be asynchronous
Closed, ResolvedPublic


Steps to reproduce:

g = OO.ui.throttle( function () { console.log( 1 ) );
console.log( 2 );

Expected behaviour: The console shows 2 then 1
Observed behaviour: The console shows 1 then 2

This is bad, because it increases code complexity if g is sometimes synchronous and sometimes asynchronous. For the same reason, Promise.resolve( x ).then( f ) always runs f asynchronously. OO.ui.throttle should take this approach too.

On the other hand, there may be existing code that depends on the synchronous behaviour.

Event Timeline

Change 513981 had a related patch set uploaded (by Divec; owner: Divec):
[oojs/ui@master] [BREAKING CHANGE] Make ve.throttle always work asynchronously

Change 513981 merged by jenkins-bot:
[oojs/ui@master] [BREAKING CHANGE] Make OO.ui.throttle always work asynchronously

Change 519341 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@master] Update OOUI to v0.33.0

Change 519341 merged by jenkins-bot:
[mediawiki/core@master] Update OOUI to v0.33.0