Daily iOS
iOS system design

News feed state model

In a gaming news feed, refresh, pagination, and bookmarking all happen at the same time. What single state and event flow would you define so the screen doesn't overwrite one response with another?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Gather items, nextCursor, the kind of work in progress, error, and the set of bookmarked ids into one FeedState value, and let a single reducer function handle every change through events like .refreshFinished, .pageAppended, and .bookmarkToggled, so the three flows can't overwrite each other's fields.

Share a question