You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A message deleted while a room page is disconnected stays on it after it reconnects #404
When a room page loses its cable connection (a laptop asleep, a dropped network) and a message in the room is deleted meanwhile, the page still shows that message after it reconnects, and keeps showing it until the room is reloaded. A message edited during the same gap does update.
Why
MessagesController#destroy, which the bot API's destroy goes through too, destroys the row and calls Message#broadcast_remove, which only reaches pages connected at that moment. When a page reconnects, refresh_room_controller.js asks Rooms::RefreshesController#show for what changed since its last load, and gets the messages created and updated since then. The edited message is among the updated ones. The deleted one no longer exists, so nothing in the refresh tells the page to remove it.
Impact
Anyone whose page was disconnected while a message was deleted keeps seeing it: a message its author took back, or one an administrator removed as spam or abuse. A reload clears it.
Steps to reproduce
This system test fails on main (eccb2d6) at its last line: after reconnecting, the page shows "Edited while offline" and still shows "To be deleted".
require"application_system_test_case"classDeletedWhileOfflineTest < ApplicationSystemTestCasetest"a message deleted while the page is offline is gone once it reconnects"doroom=rooms(:designers)deleted=room.messages.create!(body: "To be deleted",creator: users(:kevin))edited=room.messages.create!(body: "To be edited",creator: users(:kevin))sign_in"jz@37signals.com"join_roomroomassert_message_text"To be deleted"# Take the page's cable connection down and keep it down, as a sleeping laptop or a dropped network would.page.driver.browser.execute_cdp("Network.enable")page.driver.browser.execute_cdp("Network.setBlockedURLs",urls: ["*/cable*"])ActionCable.server.remote_connections.where(current_user: users(:jz)).disconnect(reconnect: true)assert_no_selector"turbo-cable-stream-source[connected]",visible: false,wait: 10# What MessagesController#destroy and #update do meanwhile.deleted.destroydeleted.broadcast_removeedited.update!(body: "Edited while offline")page.driver.browser.execute_cdp("Network.setBlockedURLs",urls: [])assert_message_text"Edited while offline",wait: 60# the edit arrives with the refresh after reconnectingassert_no_selector".message__body",text: "To be deleted"endend
Note
Since the row is gone, the refresh can't report a deletion from the database as it is: it would need the ids the page shows, a record of deleted messages, or the page to reload its list after reconnecting. Which of these fits Campfire is a design choice, so this issue doesn't propose one. #369 changes the same action, to page through more than 40 missed messages.
Written by Claude Code (AI assistant) on behalf of @namespaceMarcello, who directs this work.
A ban leaves the same gap, on more messages. User#remove_banned_content, which RemoveBannedContentJob runs after a ban, destroys each message of the banned user and calls broadcast_remove, so a page disconnected at that moment keeps all of them after it reconnects. Against the production image of main (59d2164), a member's page that was disconnected while an administrator deleted a message and banned another member still showed 13 messages no longer in the database once it reconnected: the deleted one and 12 of the banned member's.
#414 fixes both: the refresh sends the ids of the messages the page shows, and removes those no longer in the room. It needs no schema change; the other ways listed above remain open if you'd rather go one of those.
Written by Claude Code (AI assistant) on behalf of @namespaceMarcello, who directs this work.
Activity
namespaceMarcello commentedon Oct 25, 2026
A ban leaves the same gap, on more messages.
User#remove_banned_content, whichRemoveBannedContentJobruns after a ban, destroys each message of the banned user and callsbroadcast_remove, so a page disconnected at that moment keeps all of them after it reconnects. Against the production image ofmain(59d2164), a member's page that was disconnected while an administrator deleted a message and banned another member still showed 13 messages no longer in the database once it reconnected: the deleted one and 12 of the banned member's.#414 fixes both: the refresh sends the ids of the messages the page shows, and removes those no longer in the room. It needs no schema change; the other ways listed above remain open if you'd rather go one of those.
Written by Claude Code (AI assistant) on behalf of @namespaceMarcello, who directs this work.