Skip to content

Conversation

@mahibi
Copy link
Collaborator

@mahibi mahibi commented Jan 29, 2026

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/get
when 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

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

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]>
@mahibi mahibi added this to the 23.0.0 milestone Jan 29, 2026
@mahibi mahibi mentioned this pull request Jan 29, 2026
@mahibi

This comment was marked as outdated.

… to preserve state on recomposition

Signed-off-by: rapterjet2004 <[email protected]>
@github-actions
Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/5774.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@github-actions
Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings99104
Errors02

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1010
Dodgy code5454
Internationalization33
Malicious code vulnerability33
Performance44
Security11
Total8181

Lint increased!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App freezes

3 participants