Headless api issue in angular
Hi, I have implemented novu headless in our angular app. So we use methods like fetchNotifcation() , markNotifications() , listenNotificationRecevie() and delete notification(). So during these events such as markAs() the events like fetchNotifcation() is automatically triggered.
but when I trigger deleteNotification() or listenNotificationRecevie() the registered event for fetchNotifcation() is getting removed instead being called again . This breaks the usage and causing issues. Why are they getting removed instead of refetching ?
21 Replies
@Stephen could you please share the code snippet to reproduce the issue?
Actually we have implemented the above mentioned methods just like it was mentioned in the docs. We noticed this behavior is actually how it is implemented in the headless api. I just don't understand why. I saw the code and the queries are refetched when we call the markAs() method but the queries are removed when a new notification arrives or when a single notification is deleted.
@Stephen, you just advanced to level 2!
One more issue I would like to introduce is when there are two clients connected with same subscriberId. When client1 deletes a notification the client2 who is also logged in with same subscriberId must be notified of the deletion. Is there any specific event defined to listen for this change ? I have gone through the docs and don't see one
@Stephen If the subscriberId is same then deletion is performed by same user. In my opinion, user should not be notified for its own actions
Well yeah that's correct. But consider I have two chrome tabs open and logged in with same subscriberId or if I have my mobile with in-app notifications when delete in one client , it should also be removed from my mobile/ other chrome tab right ?
@Pawan Jain this is the issue i mentioned at first . Let me share screenshots
Look at this image this is method used for notification center component. Here after removing a message the queries are being refetched.
![No description](https://cdn.answeroverflow.com/1185190911588712469/tmp_cb14b299-4992-4567-bd27-f425c59e4311.png)
@Pawan Jain look at this method here. It's in headless api. After removing a notification the queries are removed why ??.
![No description](https://cdn.answeroverflow.com/1185191145484070953/tmp_c6811657-edbf-4911-9c3f-615c27214ff8.png)
@Pawan Jain
Hi @Stephen
Thanks for sharing the screenshots. it helped us in understanding the issue better π
@Engineering could someone help us why we are removing and refetching the queries?
Any updates? @Pawan Jain
Ok, it should be refetchQueries not removeQueries.
Can you please create an issue over GitHub for the same?
@Stephen
Feel free to create a github issue and share in this post
Team will priorities for sure
Alright I have identified few more issues like this. I will create and post
https://github.com/novuhq/novu/issues/5011
@Pawan Jain
GitHub
π Bug Report: Headless API issue over removing and refetching quer...
π Description In headless API we use a set of events like markAs, listenNotificationReceive, deleteNotification, deleteNotifications,etc. While we use these methods to integrate our custom componen...