Bug 1860833 - optimize number of calls to getTabClient r=fxview-reviewers,sfoster

Amending the `getRecentTabs` function eliminates one of the duplicate calls to `getTabClients`. I opted for this approach as opposed
to getting tabs from clients or vice versa because that involved a larger refactor that ended up adding unnecessary noise to the
`getRecentTabs` and `getTabClients` return values. Combined with a patch by @sfoster, we have reduced the number of calls from 9 to 1.

Differential Revision: https://phabricator.services.mozilla.com/D194656
This commit is contained in:
Nikki Sharpley 2023-11-29 14:40:39 +00:00
Родитель 8245f5c997
Коммит 9678860bec
2 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -554,7 +554,7 @@ class SyncedTabsInView extends ViewPage {
async getSyncedTabData() {
this.devices = await lazy.SyncedTabs.getTabClients();
let tabs = await lazy.SyncedTabs.getRecentTabs(50, {
let tabs = await lazy.SyncedTabs.createRecentTabsList(this.devices, 50, {
removeAllDupes: false,
removeDeviceDupes: true,
});

Просмотреть файл

@ -300,6 +300,10 @@ export var SyncedTabs = {
return this._internal.syncTabs(force);
},
createRecentTabsList(clients, maxCount, extraParams) {
return this._internal._createRecentTabsList(clients, maxCount, extraParams);
},
sortTabClientsByLastUsed(clients) {
// First sort the list of tabs for each client. Note that
// this module promises that the objects it returns are never