Page MenuHomePhabricator

[Technical] The LoadingOverlay and src/mobile.startup/rlModuleLoader.js pattern should be removed - it results in overlay flashes during switches
Closed, ResolvedPublic

Description

Page underneath the overlay flashes for 1 frame when switching between loading overlay and real overlay. This seems to be a problem with overlays in MobileFrontend and Minerva that use loadingOverlay: categories

The video below demonstrates the issue with the following overlays: editor (wikitext) and talk (previously fixed). The same was applying for categories.
(Recorded on https://en.m.wikipedia.org/wiki/The_Fighting_Temeraire using Chrome on desktop, but the same can be seen on real mobile devices.)

Event Timeline

matmarex created this task.Jan 24 2019, 9:28 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 24 2019, 9:28 PM

Change 486385 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/MobileFrontend@master] Add #loadModuleAndGetOverlay: a nicer way to use LoadingOverlay

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

Change 486386 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/MobileFrontend@master] Improve loading screens by using #loadModuleAndGetOverlay

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

Change 486387 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/skins/MinervaNeue@master] Improve loading screens by using #loadModuleAndGetOverlay

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

matmarex claimed this task.Jan 24 2019, 9:35 PM
Jdlrobson added a subscriber: Jdlrobson.

Page underneath the overlay flashes for 1 frame when switching between loading overlay and real overlay

Yeh, this is unnecessary and only because of the way we use inheritance in our codebase. The good news is we have a plan for dealing with that that will be commenced post-all hands. We've been looking at the TalkOverlay but it can apply to any overlay:
We're working towards a composition based approach to end up with code like:
https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/MobileFrontend/+/471334/

When that's done, we'll be able to move the remaining code into skins.minerva.scripts onto the critical path as it will be using code that's available from page load. I'd love to get you up to speed on those plans and get your help with making that happen!

Neat. So, compared to my proposed approach:

  • Show the loading overlay (handled by OverlayManager)
  • Start loading modules. Once loaded:
    • Replace the loading overlay in-place by the real overlay (handled by OverlayManager)

Your approach instead is:

  • Show a generic overlay (handled by OverlayManager) and put a placeholder spinner inside of it
  • Start loading modules. Once loaded:
    • Replace the placeholder contents of the existing overlay by real contents

I think that's just as elegant. I proposed my solution mostly because it did not require refactoring the existing code for different overlays, except for the one line that loads them. I didn't know you had another approach in the works.

I'll note that it doesn't really have much to do with inheritance. Certainly, you could implement it without the ugly flash with inheritance (as I did), and you could implement it with the ugly flash without inheritance, if you just put a setTimeout(), promise resolution, or something equivalent, between removing the placeolder and inserting real contents. The solution is just to replace the overlay in a single "tick".

Exactly! Also means you can exit the overlay before you finish loading (right now if your connection drops mid overlay load you become stuck!)

The main problem with the inheritance is it means the extended Overlay is not available until its associated code is loaded and if you dont code split you get a larger initial load of JS.

Will probably need some help from you with code review for the refactoring the editor overlay when we tackle that next month.

Change 486385 abandoned by Bartosz Dziewoński:
Add #loadModuleAndGetOverlay: a nicer way to use LoadingOverlay

Reason:
Jon is working on an alternative solution as part of T212465.

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

Change 486386 abandoned by Bartosz Dziewoński:
Improve loading screens by using #loadModuleAndGetOverlay

Reason:
Jon is working on an alternative solution as part of T212465.

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

Change 486387 abandoned by Bartosz Dziewoński:
Improve loading screens by using #loadModuleAndGetOverlay

Reason:
Jon is working on an alternative solution as part of T212465.

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

matmarex removed matmarex as the assignee of this task.Feb 4 2019, 7:44 PM
matmarex removed a project: Patch-For-Review.
Jdlrobson moved this task from Backlog to Bugs on the MinervaNeue board.Feb 5 2019, 6:49 PM
ovasileva triaged this task as Medium priority.Feb 8 2019, 3:01 PM
Jdlrobson claimed this task.Feb 8 2019, 7:34 PM
Jdlrobson updated the task description. (Show Details)Feb 11 2019, 10:58 PM
Jdlrobson updated the task description. (Show Details)Oct 29 2019, 5:37 PM
Restricted Application added a subscriber: Masumrezarock100. · View Herald TranscriptOct 29 2019, 5:37 PM
Jdlrobson renamed this task from Page underneath the overlay flashes for 1 frame when switching between loading overlay and real overlay to The LoadingOverlay pattern should be removed - it results in overlay flashes during switches.Oct 29 2019, 5:38 PM

@matmarex I think this is fixed for the editor? Can you confirm?

It will soon be fixed for talk too which just leaves the categories feature which may be removed.

Yes, we solved it for visual editor in T210630, and then also for wikitext editor in T228159.

Jdlrobson updated the task description. (Show Details)Oct 29 2019, 7:23 PM
Jdlrobson renamed this task from The LoadingOverlay pattern should be removed - it results in overlay flashes during switches to The LoadingOverlay and src/mobile.startup/rlModuleLoader.js pattern should be removed - it results in overlay flashes during switches.Oct 29 2019, 9:57 PM

Change 565709 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/MinervaNeue@master] Clicking the category overlay instantly displays the category overlay

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

Change 565710 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Dev: Pave the way for getting rid of rlModuleLoader

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

Change 565711 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Dev: rlModule BE GONE!

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

Jdlrobson updated the task description. (Show Details)Jan 18 2020, 12:41 AM

The above three patches should take care of this problem for the last remaining overlay and then prevent it from every happening again.

Change 565710 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Dev: Pave the way for getting rid of rlModuleLoader

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

Change 569699 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Categories: Messages do not need to be passable

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

Change 569755 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Expose headers on mobile.startup object

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

Change 569834 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] CategoryAddOverlay: Build consistently with other Overlays

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

Change 569699 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Categories: Messages do not need to be passable

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

Change 569755 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Expose headers on mobile.startup object

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

Change 565709 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Clicking the category overlays is synchronous

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

Change 565711 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Dev: rlModule BE GONE! OverlayManager routes must always be synchronous

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

Change 569834 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] CategoryAddOverlay: Build consistently with other Overlays

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

Jdlrobson renamed this task from The LoadingOverlay and src/mobile.startup/rlModuleLoader.js pattern should be removed - it results in overlay flashes during switches to [Technical] The LoadingOverlay and src/mobile.startup/rlModuleLoader.js pattern should be removed - it results in overlay flashes during switches.Feb 8 2020, 1:34 AM
Jdlrobson updated the task description. (Show Details)Feb 8 2020, 1:39 AM
Jdlrobson added subscribers: alexhollender, ovasileva.

This is done now. The category overlay now loads synchronously.

While this was a technical change...
From an @alexhollender pov this is good because clicking any button that opens an overlay now will feel more responsive then before - no more spinner.
These changes targeted the categories overlay only which is in AMC and beta. The only differences is now when clicking categories, the overlay opens instantly. In addition to this clicking next should open much more smoothly without an intermediate flash. I'm not sure how important that feature is but we can QA the categories feature if you feel that's important. Let me know @ovasileva if you need me to write QA steps.

phuedx claimed this task.Feb 11 2020, 6:07 PM
phuedx reassigned this task from phuedx to alexhollender.Feb 12 2020, 6:13 PM
phuedx added a subscriber: phuedx.

Per T214641#5861539, this is a technical change that has affected the UX of the categories overlay. It should go through design review.

Per T214641#5861539, this is a technical change that has affected the UX of the categories overlay. It should go through design review.

+1 I'm also noticing that this task went somewhat around our usual process and is in need of an estimate. Perhaps we can discuss in standup today. Also, since we have user-facing changes, we should go through QA after design review.

Jdlrobson closed this task as Resolved.Feb 24 2020, 11:53 PM

Checked in 1-on-1 with Alex and all is good here.