-
-
Notifications
You must be signed in to change notification settings - Fork 297
fix app freeze #5774
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
Open
mahibi
wants to merge
2
commits into
master
Choose a base branch
from
bugfix/5773/fixAppFreeze
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix app freeze #5774
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
avoid to initialize ComposeChatAdapter(). This is way too much and freezes the app The Text composable is of course just a placeholder to replace it with a well designed Message. However it's important that no heavy work is done in the composable to avoid the freeze Signed-off-by: Marcel Hibbe <[email protected]>
Open
Collaborator
Author
|
btw here is the log output when the app froze. |
… to preserve state on recomposition Signed-off-by: rapterjet2004 <[email protected]>
Contributor
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/5774.apk |
Contributor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

fix #5773
First of all:
The app is doing way too much work on the main thread and this needs to be investigated in general. The problem described here has certainly only caused the barrel to overflow.
The problem:
I realized that the app is freezing when pinning messages.
As i wont have more time today, could you please take over if possible @rapterjet2004 ?
I debugged and found out this is happening because of
ComposeChatAdapter().GetComposableForMessage(message)in PinnedMessage.kt
Initializing a class like ComposeChatAdapter in a Composable is not a good idea. It does way too much work incl injections.
The log even shows needless repeating calls to
/ocs/v2.php/core/autocomplete/getwhen this is initialized.
I replaced it with a plain Text composable for now which seems to fix the freeze (please test and confirm!).
Spoiler:
I already realized that the ComposeChatAdapter is a problem in the last days and i modify/delete it in #5635
So there is no need to come up with a perfect solution but it should be good enough until #5635 is merged (which will not be for v23.0).
So as we need to release 23.0RC1 (postponed to tomorrow i guess) we need a lightweight Composable that does no heavy work behind the scenes. Just the messages text and author name and and maybe avatar is fine i think.
Best will be: Do the heavy work elsewhere and pass the ready to use data into the Composable, also inside ChatActivity might be fine.
🏁 Checklist
/backport to stable-xx.x