partly correct the transitions between talk overlays

Tapping browser back button now does not show the underlying article
However clicking the back icon does (which can be fixed by a hack
see I80328b388b2e2da105bd670a3679b4ed3061b33a )

This works because displaying the talk overlay triggers a load
to mobile.talk.overlays (for talk topic board) so the other overlays
are guaranteed to be ready by the time you want to transition to them.

Bug: T221978
Change-Id: Ic3b448169d52880b38408da47af9e4576c585e16
This commit is contained in:
jdlrobson 2019-07-24 15:05:35 -07:00 committed by Jdlrobson
parent 9ece509c99
commit 02c43249cd
1 changed files with 22 additions and 6 deletions

View File

@ -45,6 +45,19 @@
return;
}
/**
* Render a talk overlay for a given section
* @param {string} id (a number e.g. '1' or the string 'new')
* @param {Object} talkOptions
* @return {Overlay}
*/
function talkSectionOverlay( id, talkOptions ) {
if ( id === 'new' ) {
return new ( M.require( 'mobile.talk.overlays/TalkSectionAddOverlay' ) )( talkOptions );
}
return new ( M.require( 'mobile.talk.overlays/TalkSectionOverlay' ) )( talkOptions );
}
overlayManager.add( /^\/talk\/?(.*)$/, function ( id ) {
var title = talkTitle.toText(),
talkOptions = {
@ -72,12 +85,15 @@
// talk case
if ( id ) {
return loader.loadModule( 'mobile.talk.overlays' ).then( function () {
if ( id === 'new' ) {
return new ( M.require( 'mobile.talk.overlays/TalkSectionAddOverlay' ) )( talkOptions );
}
return new ( M.require( 'mobile.talk.overlays/TalkSectionOverlay' ) )( talkOptions );
} );
// If the module is already loaded return it instantly and synchronously.
// this avoids a flash of
// content when transitioning from mobile.talk.overlay to this overlay (T221978)
return mw.loader.getState( 'mobile.talk.overlays' ) === 'ready' ?
talkSectionOverlay( id, talkOptions ) :
// otherwise pull it from ResourceLoader async
loader.loadModule( 'mobile.talk.overlays' ).then( function () {
return talkSectionOverlay( id, talkOptions );
} );
} else {
return mobile.talk.overlay( title, gateway );
}