skip to content

In a mobile community-board app, moderators remove posts that residents may already have cached; how should the client take them off the cache and the screen?

level: seniorimportance: should knowfreq 40%

answer

  1. absence is not removal
  2. trust an explicit signal
  3. delete from the store, every surface follows
  4. anchor if the row was above
  5. remember the id so it stays gone

basics

~20 s

Remove a post only on an explicit signal: a removal event, a removed status on fetch, or a server removal list. Delete it from the store, anchor the reader, and remember its id briefly so a late page cannot restore it.

solid answer

~50 s

First, decide what counts as removal. A post missing from a refreshed ranked page is **not** removed — it may simply have dropped down the ranking. Trust explicit signals: a live removal event naming the id, a removed answer (`410`, or a `removed` field) when the post is fetched, or a server removal list in a sync response. On that signal, delete the post from the local store in one transaction; every screen observing the store loses the row through its diff. If the row was above the reader, the list keeps the first visible post anchored by id, so nothing they are reading moves. If they have the post open, show a removed state instead of the content. Finally, keep the removed id in a short-lived local list that every merge checks, so a page fetched before the removal and arriving after it does not bring the post back.

go deeper

for a junior

Recall that a removed post must leave the stored data, not just the screen, and that a post missing from one page may still exist further down.

for a middle

Explain which signals are explicit, why 404 differs from 410, and how deleting from the store removes the row from every list that observes it.

for a senior

Show the race: a late page resurrects a deleted post unless merges check a short-lived removed-ids list, and removals above the reader need an id anchor.

for a principal

Agree the removal contract with the server: which explicit signals it sends, how fast they must reach offline phones, and how a restored post is allowed back.

## Why removal is its own problem On a community board, moderators remove posts: spam, a scam offer, a notice that breaks the rules. By then, residents' phones may hold the post in their local store, show it in the feed, keep it in a saved list, and even have it open. Removal has to reach all of that, quickly, without moving what the reader is looking at — and without the post creeping back. ## Which signals mean "removed" | Signal | Trust it as removal? | Why | |---|---|---| | a live event naming the removed post | yes | it states the fact explicitly | | fetching the post returns `410 Gone` | yes | the server says access is gone and likely permanently | | fetching the post returns `404 Not Found` | as "unavailable now" | it does not say whether the condition is permanent | | a removal list in a sync response | yes | an explicit list of removed ids | | the post is missing from a refreshed first page | no | it may have dropped in the ranking or moved to a later page | The last row is the classic mistake. A ranked feed's first page holds the top twenty posts *now*; a post that slipped to twenty-first is absent and perfectly alive. Only a window the server declares complete, or an explicit replace of the whole cached window, may drop posts merely for not being in it. Incremental sync of a whole collection, with its own removal records, is a different mechanism; the feed just consumes its result. The HTTP specification distinguishes the two status codes: `410` says the resource is no longer available and the condition is likely permanent, while `404` is used when the server cannot or will not say whether it is permanent. A client may hide a post on either, but only `410` or an explicit flag justifies treating the removal as final. ## Applying a removal 1. **Delete the post from the local store** in one transaction, together with anything that only exists for it (its cached replies, its thumbnail entry). 2. **Let every surface follow.** The feed, a saved list and search results all observe the store, so each list diffs by id and removes the row. A surface that keeps its own copy outside the store is the one that keeps showing the scam. 3. **Anchor the reader.** If the removed row sat above the first visible post, removing it moves everything up by its height. The list keeps the first visible post at its distance from the top by id; if the removed post *was* the anchor, it anchors on the next post below. 4. **Handle the open post.** If the resident is on the post's detail screen, replace the content with a plain "This post was removed" state. Silently closing the screen confuses; leaving the content up defeats the moderation. 5. **Settle pending work.** A reply the resident queued offline for that post is likely to be rejected by the server; the queue's own rules for a write that can never succeed decide how the resident is told. ## Keeping it gone Removal races with paging: - A page requested before the removal can arrive after it, still containing the post. - The list's diff cannot help: once the row is deleted, a re-arriving id looks exactly like a new post. - So the client keeps a **local removed-ids list** — the ids removed in, say, the last few hours, an assumption sized to how long a page request can be in flight or retried. Every merge drops posts whose id is on the list. Entries expire, because a server that later restores a post (an appeal upheld) must be able to send it again. A revision comparison does not solve this by itself: the stored row is gone, so there is nothing left to compare the late copy with — unless removal is stored as a row marked removed, which is the same idea under another name. ## What the reader sees - In the feed, the row disappears with an ordinary removal animation, and the reader's own post stays still. - On the open post, an explicit removed state, with a way back to the feed. - In counts and badges, numbers recomputed from the store, so "3 saved" does not include a post that no longer exists.

  • Why keep removed ids only for a few hours rather than for ever?
    The list only has to outlast pages and retries that were already in flight when the removal arrived. Keeping ids for ever grows without bound and blocks a post the server legitimately restores, for example after a successful appeal.
  • The removal event was missed because the app was offline; how does the post eventually go?
    Through the next explicit signal: a removal list in a sync response, or a 410 or removed flag when the post is fetched or opened. Its mere absence from refreshed pages is not enough, so a design that needs prompt removal must have the server send one of these.

  • A post missing from the fresh first page has been deleted
  • Removing the row from the visible list is enough; the store can keep it
  • Once deleted locally, a removed post cannot reappear
  • A 404 always means the post is permanently gone
  • Removing a post above the reader cannot move what they are reading