mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
Deleting a conversation hides the row and sends the DELETE only after the six-second undo window. The pending delete lived in a timer alone, so a reload, a closed tab or an installed app sent to the background inside the window dropped it without a request, and the conversation came back. When the window did run out, the hide filter was released while the paginated history still held the row, so it showed again until the refetch landed. Every surface that deletes a conversation (the Coach panel, the conversations page, the settings memory card) shares one hook, and the fix lives there: - a scheduled delete commits early when the page is hidden, on pagehide and on unmount, and the request is sent with keepalive - a committed row leaves every list cache, head list and every history search variant, before anything else changes, and stays hidden - deletes not yet confirmed are kept in sessionStorage; the next page hides them and sends them again, so its list read cannot bring the row back before the old page's request lands; a 404 counts as gone - a failed delete restores the lists and says so instead of the row quietly returning - Undo after the commit reports false, so the rail does not reopen a thread that is gone