-
Notifications
You must be signed in to change notification settings - Fork 331
Bug 1858789 - vastly more efficient counting of bookmarks for the hom… #4077
Bug 1858789 - vastly more efficient counting of bookmarks for the hom… #4077
Conversation
@@ -36,7 +36,7 @@ class BookmarkItemMenu( | |||
@VisibleForTesting | |||
@SuppressWarnings("LongMethod") | |||
internal suspend fun menuItems(itemType: BookmarkNodeType, itemId: String): List<TextMenuCandidate> { | |||
val hasAtLeastOneChild = !context.bookmarkStorage.getTree(itemId)?.children.isNullOrEmpty() | |||
val hasAtLeastOneChild = !context.bookmarkStorage.getTree(itemId, false)?.children.isNullOrEmpty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't technically part of the home activity changes, but while looking for other suspect uses of getTree
I discovered this, which doesn't actually need the full content of each child but will work just fine with just the IDs of the children.
fenix/app/src/main/java/org/mozilla/fenix/library/bookmarks/DesktopFolders.kt
Show resolved
Hide resolved
@rahulsainani would you be interested in reviewing this patch? I see that you had written an extension function in this that does some clean-up so figured you might be curious to try this out. As a further follow-up to BZ-1836447, we can reduce the |
Apologies, i haven't been able to look at this till now. Just got pinged by Jeff so I've added him as reviewer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Could you add a Changelog entry before you merge? :)
fenix/app/src/main/java/org/mozilla/fenix/library/bookmarks/DesktopFolders.kt
Show resolved
Hide resolved
...storage-sync/src/main/java/mozilla/components/browser/storage/sync/PlacesBookmarksStorage.kt
Show resolved
Hide resolved
Thanks! Added a changelog entry and added a "needs landing" label, so I hope the rest takes care of itself :) |
Removing the label, sorry! I see some legitimate failures in the linter task and a unit test failure with |
This pull request has conflicts when rebasing. Could you fix it @mhammond? 🙏 |
1 similar comment
This pull request has conflicts when rebasing. Could you fix it @mhammond? 🙏 |
Spoke to mark offline and recommended two changes:
cc: @boek |
🚧 Commit message is using the wrong format: remove count() method The comment message should look like:
|
This pull request has conflicts when rebasing. Could you fix it @mhammond? 🙏 |
Best I can tell the only failures here are the ones main has. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers!
I left one comment below which I'll quickly fix myself so that we can land this now.
@@ -42,6 +43,7 @@ class DesktopFoldersTest { | |||
fun setup() { | |||
context = spyk(testContext) | |||
every { context.components.core.bookmarksStorage } returns mockk() | |||
coEvery { context.components.core.bookmarksStorage.countBookmarksInTrees(any()) } returns 0U |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line will throw errors if someone tries to make an assertion that executes this line in a future test. It might be best to remove it to avoid a footgun in the future.
…e activity.
Relies on mozilla/application-services#5853 which was very recently merged - hopefully the Nightlies job will see it 😅 .
Pull Request checklist
After merge
To download an APK when reviewing a PR (after all CI tasks finished running):
Checks
at the top of the PR page.firefoxci-taskcluster
group on the left to expand all tasks.build-apk-{fenix,focus,klar}-debug
task you're interested in.View task in Taskcluster
in the newDETAILS
section.GitHub Automation
https://bugzilla.mozilla.org/show_bug.cgi?id=1858789