Jdlrobson added a subscriber: santhosh.
Jdlrobson added a project: Language-Team.
Jdlrobson added a comment.


  Hey @michael thanks for the note! Yes, this is not lazy loaded, as it's being 
executed unconditionally on any page where ULS is present.
  
  I think if the main purpose is to provide these configuration variables for 
ULS, it would make sense for ULS to load the dependency when the language 
button is clicked.
  Could you use ` mw.hook( 'mw.uls.settings.open' ).add` here instead of 
jQuery.ready to delay the execution of this code until the ULS dialog has been 
opened? If not, I'd suggest getting the language team to create a new hook that 
delays the load until the right user interaction. Adding @santhosh  to see if 
he has any ideas.
  
  Using a hook would also negate the need for the check at the beginning
  
  example diff:
  
    diff --git a/client/resources/wikibase.client.vector-2022.js 
b/client/resources/wikibase.client.vector-2022.js
    index 7d6c6de6c2..1ec4642525 100644
    --- a/client/resources/wikibase.client.vector-2022.js
    +++ b/client/resources/wikibase.client.vector-2022.js
    @@ -3,13 +3,10 @@
      *
      * @license GPL-2.0-or-later
      */
    -( function () {
    +mw.hook( 'mw.uls.settings.open' ).add( function () {
        'use strict';
     
        var itemId = mw.config.get( 'wgWikibaseItemId' );
    -   if ( !itemId || [ null, 'error', 'registered' ].indexOf( 
mw.loader.getState( 'ext.uls.interface' ) ) !== -1 ) {
    -           return;
    -   }
     
        // wait for ext.uls.interface to be ready,
        // and lazy-load the other dependencies now that we know they're needed
    @@ -35,4 +32,4 @@
                // eslint-disable-next-line no-console
                console.error( e );
        } );
    -}() );
    +} );

TASK DETAIL
  https://phabricator.wikimedia.org/T331760

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Jdlrobson
Cc: santhosh, Lucas_Werkmeister_WMDE, Jdlrobson, Michael, ItamarWMDE, Manuel, 
Peter, Aklapper, nray, Dominika_Naumiuk, JCW555, hnijhuis, Wangombe, 
Astuthiodit_1, Nishu02, Patafisik_WMF, karapayneWMDE, Invadibot, Selby, 
PallaviPatke, maantietaja, Rileych, Akuckartz, Demian, 50019062, Nandana, Lahi, 
Gq86, GoranSMilovanovic, QZanden, LawExplorer, Winter, Vali.matei, Iniquity, 
_jensen, rosalieper, Agabi10, Soum213, Taiwania_Justo, Scott_WUaS, Volker_E, 
Wikidata-bugs, aude, Lydia_Pintscher, Nikerabbit, Arrbee, KartikMistry, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to