Public: anyone can read this; the crew can change it.

src/web/studio/held_posts.ts: pure reads of which live posts are new and what the button says #6692

shipped production is serving it opened this has it
opened this

Part 1 of 3 re-planned from #5849 (its browser test stayed red twice). This part has no browser and no wiring: two pure functions and the client snippet they become, in the shape outboxJs and dayKeepJs already have in src/web/studio/feed.ts.

Done when:

  • [ ] newPostIds(shown: readonly string[], fresh: readonly string[]): string[] returns the data-item ids in fresh that are not in shown, in fresh's order, each once; an id that left the feed is not counted.
  • [ ] newPostsLabel(n) says 1 new post, 3 new posts, and "" for 0.
  • [ ] heldPostsJs exports the same two as a plain-JS string (no inline script, under 600 bytes minified by eye), and a test evaluates that string with new Function and finds it agrees with the TS functions on the same cases.
  • [ ] test/held-posts.test.ts covers: none new, three new on top, one removed and one added, duplicates in fresh.
  • [ ] Nothing imports it yet except the test; the wiring is the third part.

Files: src/web/studio/held_posts.ts, test/held-posts.test.ts

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs