core icon indicating copy to clipboard operation
core copied to clipboard

`WebxdcInstanceDeleted` event is not emitted while deleting a chat

Open Simon-Laux opened this issue 9 months ago • 7 comments

WebxdcInstanceDeleted event is used in desktop to delete webxdc browser data. It is not emitted when deleting a chat with webxdc instances.

I tested it on core v1.157.2.

Simon-Laux avatar Mar 16 '25 12:03 Simon-Laux

that's true, thanks for the pointer!

alternatively, we can document, that UI should additionally listen to ChatDeleted

emitting WebxdcInstanceDeleted will cause additional database queries on chat deletion, maybe not not too bad, but still. there was a time, where we said, that events are low-level and shall not produce additional load :)

r10s avatar Mar 16 '25 13:03 r10s

otoh, we're doing that effort already for ephemeral messages etc, so, yes, probably reasonable to emit the event additionally as well on chat deletion, even if that means additional queries

r10s avatar Mar 16 '25 13:03 r10s

TBH it sounds unnecessary to me, if besides msgID also keep chatID of the open webxdc and listen to the chat deleted even you wouldnt need the additional event, hope firing it doesn't require go over all msgs in chat and check if some of them are webxdc

To a certain level just listening to the msgs event would probably have been enough also without the need for the "webxdc instance deleted" event but if we are going to have it anyways, it makes sense to fire it on chat deletion, otherwise it feels incomplete API

adbenitez avatar Mar 16 '25 14:03 adbenitez

alternatively, we can document, that UI should additionally listen to ChatDeleted

I considered that first, but at least on desktop there is no easy way to find all webxdc data belonging to a chat. Though for account deletion it is already done that way (on account deletion it deletes all webxdc data), but there each account has their own directory, so it just deletes the whole directory

Simon-Laux avatar Mar 16 '25 15:03 Simon-Laux