3 ms·
I'm confused by why you think that there is an "invalid" state in this situation. The canonical example for that state is pagination. I have thousands of pictu
by pg_bot 9y ago
I'm confused by why you think that there is an "invalid" state in this situation.
The canonical example for that state is pagination. I have thousands of pictures loaded on a server but due to resource
constraints the server only responds with 25 pictures. When I scroll to a specific point we make a request to load more
pictures. Therefore I end up in the state of pictures being non empty and picturesLoading being true. If I were in charge
the UI for that application, I might change the opacity of the container to signal that we are loading in new data.
When we get a response from the server we can either append the data to the pictures array or we can replace it with the new data.
Depending on how you want to build your product, either choice is valid.
- jjnoakes 9y agoThe article talked about representing 3 states, and you suggested encoding those 3 states in a way that has the same split-brain issue that the article discussed. You can tell that 4 states doesn't match up with the article based on how the loading state is rendered - the pictures are ignored in those examples. Now sure, if you decide you really do need 4 states, then that's a different story and your suggestion works just fine. But that's not a solution to the article's problem.