Skip to content

fix: Update tab contents when moved#2181

Merged
nikclayton merged 1 commit intopachli:mainfrom
nikclayton:2178-move-tabs
Mar 23, 2026
Merged

fix: Update tab contents when moved#2181
nikclayton merged 1 commit intopachli:mainfrom
nikclayton:2178-move-tabs

Conversation

@nikclayton
Copy link
Copy Markdown
Contributor

@nikclayton nikclayton commented Mar 23, 2026

The previous code was using the default implementation of getItemId and containsItem in the adapter for tabs. These are based on the tab's position and don't work correctly if tabs can move in the adapter after fragments are created.

The symptom is the viewpager shows a tab in its old position after moving.

Fix this by basing the item ID on each fragment's hashcode().

Fixes #2178

The previous code was using the default implementation of `getItemId` and
`containsItem` in the adapter for tabs. These are based on the tab's position
and don't work correctly if tabs can move in the adapter fragments are created.

The symptom is the viewpager shows a tab in its old position after moving.

Fix this by basing the item ID on each fragment's hashcode().

Fixes pachli#2178
@nikclayton nikclayton merged commit d2fdf98 into pachli:main Mar 23, 2026
28 checks passed
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.

Moving tabs changes title, not content

1 participant