Skip to content

Prevent unnecessary downloads when quickly swiping through media#6439

Open
bxdxnn wants to merge 1 commit intoelement-hq:developfrom
bxdxnn:fix/media-pagination-debounce
Open

Prevent unnecessary downloads when quickly swiping through media#6439
bxdxnn wants to merge 1 commit intoelement-hq:developfrom
bxdxnn:fix/media-pagination-debounce

Conversation

@bxdxnn
Copy link
Copy Markdown
Contributor

@bxdxnn bxdxnn commented Mar 23, 2026

Content

Debounce download when quickly swiping through media files to prevent unnecessary downloads.

Motivation and context

The media player would start download on each swipe, which would make a big queue for downloading and ultimately make the media player broken as you'd need to wait for all downloads to finish.

Screenshots / GIFs

Tests

  • Swipe in media player

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

Debounce download when quickly browsing through media files to prevent
unnecessary downloads during fast swiping.
@bxdxnn bxdxnn requested a review from a team as a code owner March 23, 2026 10:56
@bxdxnn bxdxnn requested review from ganfra and removed request for a team March 23, 2026 10:56
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:

  • Your branch should be based on origin/develop, at least when it was created.
  • The title of the PR will be used for release notes, so it needs to describe the change visible to the user.
  • The test pass locally running ./gradlew test.
  • The code quality check suite pass locally running ./gradlew runQualityChecks.
  • If you modified anything related to the UI, including previews, you'll have to run the Record screenshots GH action in your forked repo: that will generate compatible new screenshots. However, given Github Actions limitations, it will prevent the CI from running temporarily, until you upload a new commit after that one. To do so, just pull the latest changes and push an empty commit.

@github-actions github-actions bot added the Z-Community-PR Issue is solved by a community member's PR label Mar 23, 2026
delay(300)
state.eventSink(MediaViewerEvents.LoadMedia(dataForPage))
}
}
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.

Hello, I do not really understand this code. To me LoadMedia is always triggered without any delay. Can you explain please?

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

Labels

Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants