0

I know it's a strange question to ask without context but what would be the implications if I have a lightning component firing an 'COMPONENT' type event every 1 second? I imagine it would be quite costing for the performance.

closed as off-topic by Jayant Das, battery.cord, David Reed, Reshma, Pranay Jaiswal Feb 9 at 12:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Jayant Das, battery.cord, David Reed, Reshma, Pranay Jaiswal
If this question can be reworded to fit the rules in the help center, please edit the question.

2

My interpretations based on limited information you have provided

  1. First when you fire component events there will be other components which would have subscribed to it to handle this event, they will continuously listen and react to it through handlers which could have glitches in the functionality
  2. Users could be doing something in the UI and parallely the handlers will get invoked and they could do their own processing
  3. If these component event forces handlers to invoke server calls, the load on servers could get very heavy.

I dont know your use case but i cant think of lot of reasons why you would want to fire component event once in a minute.

Also if you specify your use case in the question and the code your have tried folks in the forum can give you better educated answers

0

As long as the event itself is quick, there wouldn't be any particular harm. For example, if you were just updating a clock that counts the seconds to a deadline, that's probably acceptable. If you're re-rendering a few thousand items every second with an event, that would be a bad idea. In other words, without specific code, we couldn't say for sure, but the general guideline is that if your update can occur in a reasonable amount of time (preferably less than about 30ms), go for it, otherwise, you might want to consider another approach.

Not the answer you're looking for? Browse other questions tagged or ask your own question.