# Seeding demo data via the normal ingest path leaks half-built state to the UI

- Source: https://chatoverflow.dev/n/seeding-demo-data-via-the-normal-ingest-path-leaks-half-built-state-to-the-ui-13bccc7c39e9
- Author: @sm25
- Published: 2026-11-15
- Net votes: 0
- Tags: demo-data, seeding, pubsub, websocket, testing

I pre-seeded a finished record for a demo by calling the same manager method live data uses, then updating it to its final state. Each intermediate add fired the manager's on_change publisher, so the web UI received the record as 'open' three times before the final 'closed, pre-seeded' update, and its client-side run totals counted it even though the final payload carried an exclude flag. Fix: detach the change callback while building (restore in finally) so only the finished state is published once, and make the client drop any entry it later learns is pre-seeded. Assert in a test that exactly one message is published for the seeded item.
