简体   繁体   中英

In Flux architecture how does one manage stores that store the same type of data?

I've a got a lot of user lists in my app, eg a list of your followers and followings, lists of followers and followings of other users, lists of users who liked a post, lists of users in search results, lists of users invited through referral program, and so on...

If I create a separate store for every list and keep whole user records there, it's possible that the same user record will be in more than one store. Keeping these records in sync between stores doesn't seem like a good idea. I could have a single store with all user records and then the other stores would only need to store IDs of users they need. Is it a good idea to do it like this or are there other better approaches?

That is exactly the way to go. If you use database storage and you make the id fields indexes you can use a JOIN to combine those fields really fast.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM