Answer the question
In order to leave comments, you need to log in
Huge number of commits in vuex?
I'm making a drag and drop component. On the mouseMove event, I commit $store.commit('drag') - there may be hundreds of them per second.
Immediately in vuex because many components must immediately change state from coordinates.
With this approach, fps drops slightly and it is recommended not to do this and store the coordinates in local variables.
Actually why vuex is not suitable for a huge number of commits?
Answer the question
In order to leave comments, you need to log in
Because it's storage . It has to be stored there.
This is not a data bus.
If you are making a mixer component, use for example provide and inject for a common within the parent system component.
Because it will lie.
Try to handle only dragstart/dragend (add more dragover/
dragleave if needed) and skip mousemove or drag altogether.
https://developer.mozilla.org/en/docs/Web/Guide/HT...
Что вы хотите, если вы сотни раз в секунду обновляете реактивный стор на который подписаны "многие компоненты" которые тоже должны обновиться на каждый из этих сотен раз и перерисовать себя заново.
Задайте себе вопрос - зачем вам менять это сотню раз в секунду? большая часть из этого даже на экран не успеет вывестись, а скорее всего и в дом.
поставьте на свой обработчик throttle и не дергайте стор чаще чем 20-30 раз в секунду.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question