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?)

@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.

@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!

… to preserve state on recomposition

Signed-off-by: Marcel Hibbe <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
@mahibi mahibi force-pushed the bugfix/5773/fixAppFreeze branch from d833efd to 82eb71e Compare February 4, 2026 10:37
@mahibi
Copy link
Collaborator Author

mahibi commented Feb 4, 2026

/backport to stable-23.0

@mahibi mahibi merged commit 055eb13 into master Feb 4, 2026
12 of 18 checks passed
@mahibi mahibi deleted the bugfix/5773/fixAppFreeze branch February 4, 2026 10:43
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

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.

@mahibi
Copy link
Collaborator Author

mahibi commented Feb 4, 2026

Unfortunately the recomposition fix was not the "whole" solution and it's still crashing.
As discussed 1:1 with @rapterjet2004 : he will reimplement the design of the pinned message in a simple way, without out to use the ComposeChatAdapter at all. I'm pretty sure this will fix it.

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