Top Sites panel not updated after sync

RESOLVED FIXED in 1.2

Status

()

Firefox for iOS
Home screen
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: sleroux, Assigned: sleroux)

Tracking

({steps-wanted})

unspecified
Other
iOS
steps-wanted

Firefox Tracking Flags

(fxios1.2+)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
Top sites items don't seem to populate on launch with connected profile and force syncing doesn't update the panel either. Navigating to items add them to the panel as if we were a new user. After 24 hours, synced top sites appear.

> [SL] Were you seeing nothing on the Top Sites panel or just not seeing the 
> latest history items populate? Also, did this start right after updating the 
> app?  Lastly, you mentioned you tried to force sync and that didn't refresh it.
> Did you try to navigate to a few web pages afterwards?


[KR] I saw the two preloaded thumbnails, and I had to ‘find’ facebook (ie it didn’t feel like it was part of the history as I had to ‘search’ for it first). I used the app a handful of times throughout the evening yesterday, and still not populated. It only populated about 2 hours ago now (24 hours after initial setup)

I definitely navigated – did my rounds on facebook, followed a babycentre article, and went to the bbc. So those thumbnails then showed up after visiting those pages. And now (as of 2 hours ago), I finally got the whole grid of thumbnails populated.
(Assignee)

Comment 1

3 years ago
I tried the following:

1. Downloaded 1.1b1112 Aurora build (before the Top Sites caching work)
2. Opened it up, connected my FxA account, navigated around a bit
3. Top sites were populated correctly

Then,

4. Updated to 1.2b1201 Aurora
5. Launched the app (note: noticed a significantly longer startup time)
6. Opened top sites panel
7. Saw the default 2 tiles for a moment which then got replaced by my synced top sites

:kar, does this sound similar to the steps you took (except for the top sites not showing at the end)?
Flags: needinfo?(krudnitski)
Not quite. I loaded Firefox on my iPhone 6s for the first time and downloaded 1.2b1202 for the first time on that device. I signed into FxA and that's when it took 24 hours to populate top sites with my history.
Flags: needinfo?(krudnitski)

Updated

3 years ago
Keywords: steps-wanted
(Assignee)

Comment 3

3 years ago
Hm I tried to do this a few times with the 1.2b1202 on my iPhone 6 (9.1) device and can't seem to reproduce :( :kar, do you mind uninstalling and reinstalling to see if this happens a second time around?
On my iPhone 6 (9.1) and iPad Air (9.1), I see top-sites populating after Sync. By the description, this reminds me of the bug of top-sites query racing against the collectionView creation.

Works for me.
We invalidate top sites after each completed sync:

    // These selectors run on which ever thread sent the notifications (not the main thread)
    @objc
    func onProfileDidFinishSyncing(notification: NSNotification) {
        history.setTopSitesNeedsInvalidation()
    }

We background-refresh after the top sites view loads, if the cache is invalid:


    override func viewDidLoad() {
        ...
        self.profile.history.setTopSitesCacheSize(Int32(maxFrecencyLimit))
        self.refreshTopSites(maxFrecencyLimit)
    }

...

    private func refreshTopSites(frecencyLimit: Int) {
        // Reload right away with whatever is in the cache, then check to see if the cache is invalid. If it's invalid,
        // invalidate the cache and requery. This allows us to always show results right away if they are cached but
        // also load in the up-to-date results asynchronously if needed
        reloadTopSitesWithLimit(frecencyLimit) >>> {
            return self.profile.history.updateTopSitesCacheIfInvalidated() >>== { result in
                return result ? self.reloadTopSitesWithLimit(frecencyLimit) : succeed()
            }
        }
    }


so the only reasons why there would be no history visible in top sites are:

1. History didn't sync yet. If you have lots of bookmarks or logins, that would explain it.
2. You had enough local browsing data that the oldest-first history never showed in top sites. That doesn't seem to be the case here.
3. viewDidLoad isn't being called again. If the app stays resident in memory, the view won't be loaded again for a while.


If (3) is the culprit, we could consider having TopSitesPanel listen for sync-finish notifications so it can redisplay.
(In reply to Stephan Leroux [:sleroux] from comment #1)

> 4. Updated to 1.2b1201 Aurora
> 5. Launched the app (note: noticed a significantly longer startup time)

1.2 will vacuum the DB on open in order to change the page size, which essentially involves rewriting the entire file. This will be a one-time hit after upgrade. You should see

            Vacuuming to alter database page size from \(currentPageSize) to \(desiredPageSize).

in the log, and

            Vacuuming succeeded.

afterwards.
(Assignee)

Comment 7

3 years ago
(3) doesn't seem to be the culprit. When switching panels, deinit is called and viewDidLoad is called when navigating back to TopSites. Same thing happens when you show/hide the HomePanelViewController.
STR:

1) Do clean install of Firefox
2) Go to settings, login to your account
3) Stay on settings screen until sync is done
4) Close Settings
5) Open the only tab in the tab tray

Expected: Top sites is populated
Actual: Only the two default tiles are there

Workaround:

6) Switch to bookmarks panel
7) Switch to top sites panel

Top sites are refreshed.
Summary: 24 hours delay in updating Top Sites panel with synced top sites → Top Sites panel not updated after sync
tracking-fxios: ? → 1.2+
(Assignee)

Comment 9

3 years ago
Created attachment 8686249 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/1246
Attachment #8686249 - Flags: review?(rnewman)
Attachment #8686249 - Flags: review?(rnewman) → review+
(Assignee)

Comment 10

3 years ago
Landed 

2e971a8248b06ae042d8605e2c6fa52ac14780e9
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.2
(Assignee)

Updated

3 years ago
Assignee: nobody → sleroux
You need to log in before you can comment on or make changes to this bug.