-
Notifications
You must be signed in to change notification settings - Fork 731
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
Handle properly when getUser returns null - prefer using getUserOrDefault #7372
Conversation
…retrieve data asynchronously. So ensure that the initial state can always be built.
…o bulk insertion.
userItem = it, | ||
isMine = userId == session.myUserId | ||
) | ||
} ?: return super.initialState(viewModelContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaulting to super.initialState(viewModelContext) make the app crash because there is no default constructor for DeviceListViewState
(not compiling, I will iterate) |
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I would like to test that it has fixed the crash. Is it possible you add some description in the PR description in the Tests
section to do that?
Yes, done, sorry the previous description was not complete, and I did not create a dedicated issue about the crash. A few reports with this crash are coming from the PlayStore, and it can hard to reproduce locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Type of change
Content
getUser can return null, since the loading of profile is now async. It may lead to unexpected issue and a crash, fixed by this commit: 0a6d620
Other commits fixes similar things. Also when retrieved, the profile is now stored into DB for future usage.
Motivation and context
Screenshots / GIFs
Tests
To reproduce the crash (but this is not 100% reproducible due to race condition)
Tested devices
Checklist