Closed idoadse closed 6 years ago
Hey, @idoadse thank you for contacting us but please notice that this repository is for logging issue, bugs and feature request related to nativescript-angular. For how-to related questions please use the community channels like the NativeScript forum, SO or the community slack channel.
Regarding your issue
The provided code base is not enough to recreate the whole scenario. However, one thing I am noticing is the usage of setTimeOut
for each message received from your chat service.
setTimeout(() => { // timeout for letting the chat messages to be set over the view first
if (this.shouldScroll()) {
this.scroll();
}
}, 50);
I would expect the above code to be obsolete by design. Still, that might nothing to do with your performance issues and providing a working demo to debug would help a lot.
I can also suggest taking a look at this blog post about implementing live chat in NativeScript + Angular.
There is also a created plugin for implementing chat view which can also be of help.
Closing the issue as how-to related.
Additional note: I noticed using a ngFor
structural directive where you can use ListView
(with out-of-the-box recycling and virtualization performance optimizations) =- this might improve your UI performance greatly (as implemented here).
Hey Nick, thank for the clarification and the assistance! I will try your suggestions and continue the thread (if ill still need assistance) in one of the channels you have suggested. Thanks again
Same problem. I am using ngrx as well. 50 items it taks few seconds to render.
Hi guys, Im having some performance issues with rendering a chat view. The first loading of the component (loaded with 30 last messages) takes about 4 seconds which is a lot of time. The issue is not related to loading time of the chats from the server - when im bringing data to the memory of the device, it still takes a lot of time to render (about 150 messages take more than 10 seconds) I have already implemented the optimizations in this optimization guide and it seems to not significally improve performance.
Im working with nativescript 3.4.0, and I encounter the slowness both with android and iOS real devices.
I have removed most of my code that is irrelevant for reproducing the slowness and it is attached below:
My chat html implementation is attached:
My component code:
The underline implementation of chatService holds an Observable<Array> that holds the messages (haven't posted it to spare some space)
I would really appreciate if someone could help tackle the issue / improve my UI view.
Thanks,