only render events after relay acceptance
Every Nostr write operation fired handleEvent/onSuccess on the first relay OK frame without checking msg[2] (the success boolean), so a rejection was treated as an acceptance. Rejected events appeared in the UI and vanished after refresh. Also fixes a data-loss risk in updateStoryWithKindChange where the original story could be deleted even if the replacement was rejected by all relays.
Adds publishWithAck in nostr-create.js — waits for msg[2] === true before calling success callbacks, and shows a toast with the relay's reason on all-rejections or timeout. sendMessage now returns its dispatch count so the helper knows how many OK frames to expect.
Also fixes duplicate toasts: sendMessage gains a silent option so publishWithAck owns all user messaging on the publish path, preventing two toasts for the same failure. Error messages are Strapi-backed via window.wowMessages (falling back to hardcoded English).
What this affects- send-message.js — returns relay dispatch count (non-breaking; existing callers ignore the return value)
- nostr-create.js — all write paths via create(): comments, reactions, RSVPs, stories, calendar events, profile, follows, bookmarks, file metadata, deletes
- src/layouts/Layout.astro — exposes window.wowMessages from globals.texts on every page
- src/utils/getGlobals.ts — adds 4 relay message keys to the Texts type (relayNoConnection, relayTimeout, relayPublishFailed, relayPublishRejected)
To override the fallback strings
1. Log in and post a comment — it should appear and persist after refresh. 2. To test the failure path: post while disconnected from all relays — a toast should appear and nothing should render.
Updates · newest first
- preview ↗ Merge branch 'main' into fix/relay-ok-ack-before-render
- preview ↗ Merge branch 'main' into fix/relay-ok-ack-before-render
- preview ↗ fix: localized relay connection messsage
- no preview Merge branch 'main' into fix/relay-ok-ack-before-render
- preview ↗ fix: only render events after relay acceptance