Skip to content

Deleting a record from extend with JavaScript does not trigger frontend realtime event #3695

Answered by ganigeorgiev
kidino asked this question in Q&A
Discussion options

You must be logged in to vote

Raw DB queries don't trigger the realtime events.
They are triggered only when the onModel* hooks are fired, eg. when the related $app.dao().saveRecord() or $app.dao().deleteRecord() method is called.

In the onRealtimeDisconnectRequest hook try to replace your delete query with:

const record = $app.dao().findFirstRecordByData("active_mouse", "realtime_id", e.client.id());
$app.dao().deleteRecord(record);

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ganigeorgiev
Comment options

Answer selected by kidino
@kidino
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants