Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

fix (systemaddon): #3058 refresh TopSitesFeed when TippyTopProvider init is complete #3088

Merged
merged 1 commit into from
Aug 3, 2017

Conversation

rlr
Copy link
Contributor

@rlr rlr commented Aug 3, 2017

Fixes #3058

r? @Mardak

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.407% when pulling 6cc3208 on rlr:gh3058/tippytop-init-then-refresh into 3285650 on mozilla:master.

switch (action.type) {
case at.INIT:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could still fail due to a race condition, because NEW_TAB_LOAD could be fired before this._tippyTopProvider is done initializing. I think it might be better to do something like this inside refresh:

if (!this._tippyTopProvider.initialized) await this._tippyTopProvider.init()
// continue refreshing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was discussing with @Mardak on IRC: "so adding this refresh means it could refresh earlier than necessary or result in a second refresh after a first NEW_TAB_LOAD"

But we figured that might be better than holding up the refresh when a NEW_TAB_LOAD event comes in. Don't you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlr and I did chat about this and decided that if we do have a NEW_TAB_LOAD it seemed undesirable for it to be blocked on a potentially unbounded amount of time for tippyTopProvider.init

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And on the flip side, if tippyTop does resolve sooner than NEW_TAB_LOAD, the state will already be updated and not refreshed due to the 15-minute check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if we block NEW_TAB_LOAD, the section would be collapsed until there were sites. (Although that early, other things aren't quite loaded yet either including strings !)

Check out this 10x slowed-down video of a debug build with this patch (and my load-correctly-on-startup patch):
https://ed.agadak.net/as/activity-stream.startup.10x.webm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 Cool video. How do you do that?

Copy link
Member

@Mardak Mardak Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Screenflow, but any screen recording software with editing should be good. (Oh it exports by default to mp4 and I used Miro video converter to make it webm)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose one downside of the "go ahead without waiting" is that it'll trigger fetching screenshots.

@rlr rlr changed the title fix (systemaddon): #3058 refrest TopSitesFeed when TippyTopProvider init is complete fix (systemaddon): #3058 refresh TopSitesFeed when TippyTopProvider init is complete Aug 3, 2017
Copy link
Member

@Mardak Mardak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll file a separate issue about startup behavior, but I think this approach is good enough for the common case of people opening up a new tab not immediately on startup as the state will already be populated with an already-refreshed sites with tippy top data. In the less common case where toppyTopProvider.init() resolves after NEW_TAB_LOAD has already responded without waiting, the user would at least be able to see the sites and letter/hostname.

switch (action.type) {
case at.INIT:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if we block NEW_TAB_LOAD, the section would be collapsed until there were sites. (Although that early, other things aren't quite loaded yet either including strings !)

Check out this 10x slowed-down video of a debug build with this patch (and my load-correctly-on-startup patch):
https://ed.agadak.net/as/activity-stream.startup.10x.webm

@Mardak Mardak merged commit 835317a into mozilla:master Aug 3, 2017
@as-pine-proxy
Copy link
Collaborator

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants