Fix deleted rooms persisting in navigation #285

Merged
hodlbod merged 1 commits from userAdityaa/flotilla:fix-room-delete-nav into dev 2026-05-29 15:20:22 +00:00
Collaborator

Summary

  • Fix room deletion not removing the room from the sidebar, even after refresh
  • The timestamp comparison used gt (strictly greater than) — when the ROOM_DELETE event has the same created_at as the ROOM_META, the room survived the filter. Switched to gte.
  • Also fetch ROOM_DELETE events in loadRoom so direct navigation to a deleted room picks up the deletion.

closes #194

### Summary - Fix room deletion not removing the room from the sidebar, even after refresh - The timestamp comparison used `gt` (strictly greater than) — when the `ROOM_DELETE` event has the same `created_at` as the `ROOM_META`, the room survived the filter. Switched to `gte`. - Also fetch `ROOM_DELETE` events in `loadRoom` so direct navigation to a deleted room picks up the deletion. <video src="attachments/38062e6c-3fba-450a-984c-2dc6c760e803" title="Screen Recording 2026-05-26 at 1.15.28 PM.mp4" controls></video> closes #194
userAdityaa force-pushed fix-room-delete-nav from 3d9898f6b2 to 55137237b5 2026-05-26 07:37:06 +00:00 Compare
userAdityaa force-pushed fix-room-delete-nav from 55137237b5 to b42ba377e5 2026-05-26 07:47:36 +00:00 Compare
hodlbod reviewed 2026-05-26 15:53:48 +00:00
@@ -597,2 +597,4 @@
Boolean(relay?.supported_nips?.map?.(String)?.includes?.("29"))
const getRoomDeleteId = (event: TrustedEvent) =>
getTagValue("h", event.tags) || getTagValue("d", event.tags)
Owner

The d tag will never match, room delete always uses h

The `d` tag will never match, room delete always uses `h`
@@ -608,0 +618,4 @@
if (h) {
deletedByH.set(h, max([deletedByH.get(h), event.created_at]))
}
}
Owner

this is unnecessary, deletes are already in roomMetaEventsByUrl right?

this is unnecessary, deletes are already in roomMetaEventsByUrl right?
Author
Collaborator

It’s already there, but after deleting a room and refreshing, the deletion took a second to reflect.

so I did this to avoid the user noticing that delay even for a moment.
let me attach a video for it.

It’s already there, but after deleting a room and refreshing, the deletion took a second to reflect. so I did this to avoid the user noticing that delay even for a moment. let me attach a video for it.
Owner

I see, the roomMetaEventsByIdByUrl isn't populated until the event is accepted by the relay? This should be something taken care of by welshman's thunk — it populates both repository and tracker optimistically when publishing. I would debug why that's not working rather than add this band-aid.

I see, the roomMetaEventsByIdByUrl isn't populated until the event is accepted by the relay? This should be something taken care of by welshman's thunk — it populates both repository and tracker optimistically when publishing. I would debug why that's not working rather than add this band-aid.
Author
Collaborator

please focus on caravel from your side for now since it’s the priority. I’ll dig into this issue a bit more from my end.

please focus on caravel from your side for now since it’s the priority. I’ll dig into this issue a bit more from my end.
hodlbod reviewed 2026-05-27 17:46:30 +00:00
hodlbod left a comment
Owner

See review comments

See review comments
userAdityaa force-pushed fix-room-delete-nav from b42ba377e5 to 92cc000004 2026-05-28 09:57:08 +00:00 Compare
hodlbod reviewed 2026-05-28 22:28:09 +00:00
@@ -611,3 +613,3 @@
for (const event of deleteEvents) {
for (const h of getTagValues("h", event.tags)) {
const h = getRoomDeleteId(event)
Owner

Just leave getTagValues, getRoomDeleteId is unnecessary if you understand the data model

Just leave getTagValues, getRoomDeleteId is unnecessary if you understand the data model
@@ -654,1 +658,3 @@
filters: [{kinds: [ROOM_META], "#d": [h]}],
filters: [
{kinds: [ROOM_META], "#d": [h]},
{kinds: [ROOM_DELETE], "#h": [h]},
Owner

It looks like this is the only substantial change, does this fix it on its own?

It looks like this is the only substantial change, does this fix it on its own?
Author
Collaborator

It looks like this is the only substantial change, does this fix it on its own?

It seems to be fixed now. Could you please confirm from your side as well?

> It looks like this is the only substantial change, does this fix it on its own? It seems to be fixed now. Could you please confirm from your side as well?
userAdityaa force-pushed fix-room-delete-nav from 92cc000004 to 4c737b26c0 2026-05-29 06:35:32 +00:00 Compare
hodlbod added 1 commit 2026-05-29 15:20:04 +00:00
hodlbod force-pushed fix-room-delete-nav from 4c737b26c0 to 594231ea48 2026-05-29 15:20:04 +00:00 Compare
Owner

Looks good to me

Looks good to me
hodlbod merged commit 152d35f92a into dev 2026-05-29 15:20:22 +00:00
hodlbod deleted branch fix-room-delete-nav 2026-05-29 15:20:22 +00:00
Sign in to join this conversation.