Skip to content

fix(mobile): items not deselecting on back button #17403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2025

Conversation

YarosMallorca
Copy link
Collaborator

Description

Fixed back-button logic on asset grid.
Before, when items were selected, upon pressing the back button, they wouldn't deselect. This fixes that behavior.

How Has This Been Tested?

  • Select one or more items on the main grid, trash, or in an album, then press the back button - it will deselect the items, but not pop the route
  • Go to an album, and press "add photos", on the next screen, select a couple of photos to add, but then press the back button, the selected photos will deselect themselves (but the ones that were preselected will stay). If only preselected are currently selected, it will pop the route.

Video demo

back-button-fix.mp4

What's left to fix?

On the search results page, it still doesn't prevent the route from popping when assets are selected.
I cannot figure out why on the search results page, the _selectedAssets in ImmichAssetGridView is always empty. If someone could take a look at that or point me in the right direction, I would highly appreciate it :)

Copy link
Member

@shenlong-tanwen shenlong-tanwen left a comment

Choose a reason for hiding this comment

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

The Search page seems to be acting weird. The first pass to the PopScope are the default values, so selectionActive - false and selectedAssets - empty and so the pop actually happens. However, the onPopInvokedWithResult callback is called again, this time with the proper value, but by this time the Route already pops off.

Commenting out the else part to prevent and pressing the back button puts the timeline in a weird state as well. Probably worth investigating separately.

@YarosMallorca YarosMallorca changed the title fix: items not deselecting on back button fix(mobile): items not deselecting on back button Apr 6, 2025
@alextran1502 alextran1502 merged commit a724f14 into main Apr 7, 2025
53 checks passed
@alextran1502 alextran1502 deleted the fix/deselect-on-back branch April 7, 2025 14:35
midzelis pushed a commit that referenced this pull request Apr 10, 2025
* fix: items not deselecting on back button

* chore: add comments
savely-krasovsky pushed a commit to savely-krasovsky/immich that referenced this pull request Jun 8, 2025
* fix: items not deselecting on back button

* chore: add comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants