summaryrefslogtreecommitdiff
path: root/ui/lib/components/ChannelList.svelte
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-05-02 02:13:19 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-05-05 19:54:22 -0400
commit8a329eb962eb98e89b41708d92b3f9298e4c21e1 (patch)
tree3827417c1cb87e9c7dac5f4750c86e847b72fba3 /ui/lib/components/ChannelList.svelte
parent1035eb815f5a4996d8f546aa4b85da29ccea5d73 (diff)
Warn the user before navigating away, when the outbox has messages in it.
This is in lieu of saving the outbox. I tried that, and: * If messages are dropped from the saved outbox before calling `api.postToChannel`, then messages "in flight" are lost when the page is reloaded unless the send succeeds after the client vanishes, as they are not re-sent when the page loads. * If messages are dropped from the saved outbox after calling `api.postToChannel`, then messages "in flight" are duplicated when the page is reloaded and they get re-sent. The CAP theorem is real and can hurt you. The appropriate compensating mechanism would be a client-generated per-operation nonce, with server-side support for replaying responses by nonce if an operation already completed. That's a pretty big undertaking, and it's one we should probably do, but it's larger than I want to take on right now. Instead, we warn the user, and they can make their own decision. Except we don't, sometimes. When the client runs in a browser, this event handler prompts the user for confirmation before reloading, navigating away, closing the tab, or quitting. When run in a Safari app container, though, it only warns before reloading. Closing the window or quitting the app do not provoke a prompt. The warning is "best" effort. The failure mode is lost messages, which isn't particularly best.
Diffstat (limited to 'ui/lib/components/ChannelList.svelte')
0 files changed, 0 insertions, 0 deletions