React component page executing too many times

Hello, I am working with the Amity UIKit for Web (react), and also adding a bit of code for my app’s purpose.

On the src/chat/components/Chat/index.js, I have added some code that gets the user’s meta data, accesses a certain property (teamId), and automatically creates a new chat channel by that id, and if it already exists, joins that channel.

My issue is that when I am running the app, this page get its code run too many times repetitively, and the console logs get spammed.
For example, there’s a console log at line 28 (“Hit the application page […]”) that keeps getting printed, and therefore makes the page lag.

Could you have a look at this class, and give me a pointer as to what could be causing this page to re-run this code so many times?

(Let me know if I should take it off pastebin and share another way)

hi @abhishek ,

Which JS SDK vers. are you using?

Thank you,
Amity Support

Hi team,

I believe our forked version of the Amity web UI Kit repo has 2.15.6 (2023-04-10) latest in the change logs.

1 Like

Thank you, we’re passing to the team to help check :))

1 Like

Hello, could we please gather more information regarding the log entry at line 28? What is the purpose of adding this log entry?

Hello, the console log at line 28 was just added initially to see how/when this page loads, and to debug the defaultChannelId.
I can remove the log as it serves no purpose, but it let me know that this react component was executing its code too many times.

1 Like

Hello, I’ve discussed this with the team, and we plan to log it as a performance improvement in our future plans. I just wanted to confirm that it isn’t causing any crashes or issues, is that correct?

It (potentially) cause slowness/lag to the overall chat page and the input field typing, but not necessarily a crash.

Noted. Could you please elaborate on the severity of the slowness and lagging? This information will help us assess the issue’s priority. In the meantime, we will log it for future improvements.

The severity seems critical based on the user experience.

After the chat is loaded, usernames/profile pictures take another second to load, and scrolling up and down shows delayed feedback.
If you’ve had a chance to play with the code snippet I provided on the post, did you experience lag on your end?

Hello, we are aware of the lagging on the chat uikit performance - you may have noticed a slight delay of a few seconds when loading. Rest assured, we’ve taken note of this and have plans in place to make it more efficient.

1 Like

Hello team,

There’s also an issue with some leak on the chat of the UI Kit.
When I open the team chat, and leave it on for 5~ minutes, it starts to lag, and eventually it crashes. Are you experiencing this as well?

It shouldn’t crash, we don’t experience this on our end. Could you please help share the error/log?