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

User mention is not highlighted unless I reload the chat #578

Closed
f3dm76 opened this issue Aug 13, 2024 · 7 comments
Closed

User mention is not highlighted unless I reload the chat #578

f3dm76 opened this issue Aug 13, 2024 · 7 comments

Comments

@f3dm76
Copy link

f3dm76 commented Aug 13, 2024

What did you do?

I typed in @<user_name>, picked a name from the built-un mentions picker, and sent a message. Then I tapped on the user name prefixed by @ inside the message.

What did you expect to happen?

I expected that in the message body my user mention would be highlighted with a corresponding link color. I also expected the link tap handler to be called when I tap the mention.

What happened instead?

Nothing happened - it's just a plain text. It only starts working once I go away from the chat and come back again.

GetStream Environment

GetStream Chat version: StreamChat 4.61.0, StreamChatSwiftUI 4.61.0
GetStream Chat frameworks: StreamChat, StreamChatSwiftUI
iOS version: ios 18.0
Swift version: 5
Xcode version: 15.0.1
Device: sim iPhone 15 Pro Max

Additional context

I fixed it locally by adding .onChange(of: message.mentionedUsers) to LinkDetectionTextView and duplicating onAppear body inside of it. But you might have a better approach in mind

Here is a video of the bug
https://github.com/user-attachments/assets/795f2036-522c-49f8-b444-f23520de216b

@martinmitrevski
Copy link
Contributor

Hi @f3dm76,

We can't reproduce this issue on our default components (see the attached video). Are you maybe using some custom components around the text messages that might be causing this?

RPReplay_Final1723536643.MP4

Best, Martin

@f3dm76
Copy link
Author

f3dm76 commented Aug 13, 2024

Hey @martinmitrevski, I just removed the usage of a custom ViewFactory completely - here is all I do:
streamChat = StreamChat(chatClient: chatClient)
still the bug is there.

I understand that you cannot reproduce, I see indeed that it works in your chatUI example project. Does this example use actual BE? Maybe it works because there is no real life latency for message appearing?

The fact that the mentions are only checked on onAppear of a message looks incorrect - I can clearly see while debugging that it gets called with empty mentionedUsers. When adding onChange like I said, mentionedUsers come there.

@martinmitrevski
Copy link
Contributor

The message already includes the mentioned users, therefore it's safe to check this in onAppear, there's no extra BE call to fetch them. I even tested with the network link conditioner and a very bad network, and it still works correctly.

In any case, if it works for you by adding an onChange modifier - I don't see any harm in having it.

@f3dm76
Copy link
Author

f3dm76 commented Aug 13, 2024

I just commented out all of the DemoAppFactory's body - and it stopped working on SC example project. onChange I added is inside SC library code, I'd like to avoid moving to a fork over such a simple matter.

@f3dm76
Copy link
Author

f3dm76 commented Aug 14, 2024

Hey @martinmitrevski, were you successful in reproducing the issue the way I described?

@martinmitrevski
Copy link
Contributor

Hi @f3dm76, yes, I can reproduce it. Seems like an issue in our low-level client, we will check it. If it's not, we will apply your fix instead.

@martinmitrevski
Copy link
Contributor

Will be fixed here: #582.

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

No branches or pull requests

2 participants