Surface publish warnings in the editor instead of discarding them #26
Reference in New Issue
Block a user
Delete Branch "feat/publish-warnings"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Companion to whp PR #48 (
feat/publish-broken-asset-check). Ship together — the backend emits the warnings, this renders them.The bug this fixes
handlePublishhas always returned awarningsarray in its publish response. Nothing in the editor has ever read it —TopBar.tsxchecked onlyresult.successand flashed "Published" for 3 seconds.So the contact-form relay warning — "submissions will not be delivered until an administrator enables it" — has been dead code for its entire life. No customer has ever seen it. A customer whose contact form silently went nowhere was never told.
This makes warnings visible, which revives that warning for free and carries the new broken-asset warnings from the companion PR.
What's here
PublishWarnings.tsx— a non-blocking, dismissible banner. Renders nothing when there are no warnings (the common, healthy-site case).TopBar.tsx— holds warnings in their own state and renders the banner in both the mobile and desktop branches (TopBar early-returns for mobile, so a single render site would silently not exist on mobile).Details worth knowing
role="status"(notalert), amber rather than the error red, dismissible.publishStatusprecisely so the existingsetTimeout(…, 3000)doesn't take them down before the customer can read them.{w}), so React escapes them — the strings interpolate customer-controlled page names, and this is what stops a page titled with markup from self-injecting. NodangerouslySetInnerHTML..topbargainedposition: relative— the banner'sposition: absolute; top: 100%needs a positioned ancestor or it renders off-screen. Verified zero blast radius: no other absolutely-positioned descendant lives under.topbar, the modals portal to body, and the mobile overflow menu isposition: fixed.Testing
918 tests / 90 files passing,
tscclean.TopBar.test.tsxcovers the wiring seam specifically — and that matters here more than usual, because the wiring was the bug: the relay warning died precisely because TopBar discardedresult.warnings. The test was confirmed to fail against deliberately-broken wiring:result.warnings(the original bug) → 4/5 tests failTests use the repo's existing
react-dom/client+act()harness (@testing-library/reactisn't installed here).🤖 Generated with Claude Code