Skip to content

bookmarks: Remove broken position plumbing and dead getItemId - #2044

Merged
svillar merged 1 commit into
Igalia:mainfrom
NAME-ASHWANIYADAV:fix/remove-broken-bookmark-position
Aug 14, 2026
Merged

bookmarks: Remove broken position plumbing and dead getItemId#2044
svillar merged 1 commit into
Igalia:mainfrom
NAME-ASHWANIYADAV:fix/remove-broken-bookmark-position

Conversation

@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor

Fixes #2043

What

Removes Bookmark.mPosition (hardcoded to 0), Bookmark.getPosition(), and the BookmarkAdapter.getItemId() override — 16 deletions, no additions — resolving the three linked TODOs at Bookmark.java:35-37, Bookmark.java:81 and BookmarkAdapter.java:325.

Why

getPosition() always returns the hardcoded 0 (the TODO notes upstream moved to kotlin.UInt, which Java cannot consume directly), and its only caller is getItemId(), which never runs: the adapter sets setHasStableIds(false) (BookmarkAdapter.java:61), so RecyclerView never consults it.

Restoring the position via a Kotlin interop shim — what the TODOs contemplate — would not actually fix getItemId(): the display list flattens several folders into one list, so position-in-parent repeats across folders (duplicate ids) and changes when items move, while stable ids must identify the item itself. The adapter already has the right identity mechanism — its DiffUtil callback compares GUIDs in areItemsTheSame() (:107-110) — which is what drives list updates today.

No behavior change: hasStableIds is false before and after, so the removed override was unreachable, and the removed field had no other consumer (verified by search over app/src).

If stable ids are ever wanted for the bookmarks list, getItemId() should be derived from the GUID, matching the DiffUtil callback.

Testing

  • Builds: ./gradlew assembleNoapiArm64GeckoGenericDebug
  • Existing unit tests pass: ./gradlew testNoapiArm64GeckoGenericDebugUnitTest

Bookmark positions were hardcoded to 0 since the kotlin.UInt change,
and their only consumer was a getItemId that never runs with stable
ids disabled. Item identity already comes from GUIDs via DiffUtil.
@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor Author

@svillar PTAL !!

@svillar svillar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK seems a good cleanup. Too risky for a release though.

@svillar
svillar merged commit 55975fe into Igalia:main Aug 14, 2026
6 checks passed
@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor Author

thanks !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bookmark position is hardcoded to 0 and its only consumer never runs

2 participants