Skip to content
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

fix(mobile): sync issue #9149

Merged
merged 1 commit into from
Apr 29, 2024
Merged

fix(mobile): sync issue #9149

merged 1 commit into from
Apr 29, 2024

Conversation

alextran1502
Copy link
Contributor

@alextran1502 alextran1502 commented Apr 29, 2024

useEffect does what it is supposed to do, which is to rerun the function body when the target property changes, i.e., user. So when we log out and invalidate the user, it runs again and saves the current user ID back to the storage while the user information is deleted. That causes the sync mechanism, which uses the userId to look for the User's information, now, not exist in the database any more after being logged out and hasn't been populated yet from the login success call, ultimately returning error and aborting the sync mechanism, leading to the user doesn't see the applicable changes they suppose to see on the phone.

Tested by logout and log back in while monitoring the Isar database for a couple dozen times to make sure that the current user id and user information are deleted when logging out

Fixes #9065

Copy link

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: 15444fe
Status:⚡️  Build in progress...

View logs

Copy link
Contributor

@fyfrey fyfrey left a comment

Choose a reason for hiding this comment

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

State management is really a mess, it's so brittle.

Changes look good.

@alextran1502 alextran1502 merged commit 87de809 into main Apr 29, 2024
25 of 29 checks passed
@alextran1502 alextran1502 deleted the fix/mobile-sync-issue branch April 29, 2024 13:54
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.

Immich android reports error in logs
2 participants