Debounce observables update #3283
Unanswered
MatanYemini
asked this question in
Q&A
Replies: 1 comment
-
Hi @MatanYemini I've moved this issue to discussions since it's more Q&A rather than an issue with library. Regarding your question - I prefer to debounce the action that updates an observable using libraries like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
Wanted to ask about what is the best practice regarding debouncing an observable update.
I will describe my use case -
One of my observable objects is kinda big (a mistake, can refactor, a bit problematic considering the time frame we have), he tends to be updated a lot, especially when the system is loaded and there is a lot of live users.
Wanted to know if there is something built-in or an option to update the observable with debounce OR updating the observable decorator OR any other idea?
Example:
@observable bigArrayOfObjects = [{}]
(updated in the app)@observable regularMediumSizeArray = []
(updated in the app)@computed get combinationOfTheTwoAbove() { .... return coolArrayOfObjects }
combinationOfTheTwoAbove ==> being called too many times
Of course, we can go with updating an observable, put reaction / useEffect on it, and once it's triggered we can call a denounced function that will insert the value to the origin observable. Saw another option with viewModel in mobx-utils, but I prefer something that will require fewer changes from my end.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions