4 ms·
How do changes to that cache get displayed? Your cache emits events that each UI element has to listen to? Congrats you’re using redux! (It would perhaps be mo
by wilde 4y ago
How do changes to that cache get displayed? Your cache emits events that each UI element has to listen to? Congrats you’re using redux!
(It would perhaps be more accurate to say that React folks had to reinvent these patterns, but the problems were definitely present in the postback era)
- petilon 4y ago> Your cache emits events that each UI element has to listen to? It doesn't. How often do you have the same information redundantly displayed in multiple places, on the same screen?
- ativzzz 4y agoIt's not even necessarily the same information, but small pieces of one bigger piece that need to be updated once some of the other smaller pieces change
- wilde 4y agoYeah this. The classic is unread state in a mail app. Unread state is usually displayed both as bold state per message in a message list, and as a count in the folder list. These need to stay in sync as the user reads mail (and sometimes marks read state explicitly). Two views of the same underlying state.
- petilon 4y agoSure, you can come up with an example where some synchronization is needed, but how often do you have this requirement? In most apps it is rare, which means that it can be solved by using a couple of extra lines of code to update the screen, as opposed to adopting a complex state management system with events firing and so on. Simple solutions for simple problems.
- wilde 4y agoIt is quite common. Take this screenshot of Youtube: https://imgur.com/a/nxGdcWj https://imgur.com/a/nxGdcWj The comments total at the top and each of the thread counts need to be kept in sync with their corresponding inline list representations. Most lists in apps display a total count summary. This is even more common on desktop, where you have room to display more info.