facebookarchive / flux

Application Architecture for Building User Interfaces
https://facebookarchive.github.io/flux/
Other
17.47k stars 3.46k forks source link

make reduceStore override __onDispatch instead of __invokeOnDispatch #449

Closed chrishan17 closed 6 years ago

chrishan17 commented 6 years ago

"Subclasses must override this method. This callback is the only way the store receives new data." what you say in FluxStore

kyldvs commented 6 years ago

__invokeOnDispatch is at an earlier point than __onDispatch in the call stack. Overriding the former is perfectly fine, it just required extra book-keeping that FluxStore would normally handle automatically. This earlier hook is important to make FluxReduceStore work efficiently and conveniently.

The documentation in FluxStore is referring to subclasses that are real data stores, not other store interfaces that will be further extended.

Feel free to provide more context on why you are making this change if you ran into issues because of it.

chrishan17 commented 6 years ago

emm, i misunderstand the documentation. Thanks for the explanation

kyldvs commented 6 years ago

No problem, thanks for checking!