Open true-eye opened 4 years ago
Subscriptions are "live queries" and will give you the result of the subscribed query, whenever it changes. In your case, you have subscribed to the result of "last created note" and hence after you delete a note you get the previously created one.
There are many ways to find out what notes got deleted through this query. One way to delete all notes which are > created_at
(assuming only newer notes are deleted). Another way is use the subscription as a "notification" service and refetch the new list of notes that you want to display. Another way is to put a deleted column (i.e. a soft delete) instead of removing the entire row.
You can also talk to our community for such questions here: https://discord.com/invite/hasura
Hi, Team! I have a question about the delete subscription I'm building a simple chat application and I have a 'notes' table. When I delete a 'note' from one side, I would like to subscribe to it on the other side to delete it on the UI.
For the performance, I just subscribe to the latest But when I delete a note, it doesn't subscribe to the deleted note. Instead, it returns the previously created one.
Please help me Thanks in advance.