N
Novuβ€’12mo ago
Stephen

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
Pawan Jain
Pawan Jainβ€’12mo ago
@Stephen could you please share the code snippet to reproduce the issue?
Stephen
StephenOPβ€’12mo ago
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.
Novu_Bot
Novu_Botβ€’12mo ago
@Stephen, you just advanced to level 2!
Stephen
StephenOPβ€’12mo ago
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
Pawan Jain
Pawan Jainβ€’12mo ago
@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
Stephen
StephenOPβ€’12mo ago
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
Stephen
StephenOPβ€’12mo ago
Look at this image this is method used for notification center component. Here after removing a message the queries are being refetched.
No description
Stephen
StephenOPβ€’12mo ago
@Pawan Jain look at this method here. It's in headless api. After removing a notification the queries are removed why ??.
No description
Stephen
StephenOPβ€’12mo ago
@Pawan Jain
Pawan Jain
Pawan Jainβ€’12mo ago
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?
Stephen
StephenOPβ€’12mo ago
Any updates? @Pawan Jain
BiswaViraj
BiswaVirajβ€’12mo ago
Ok, it should be refetchQueries not removeQueries. Can you please create an issue over GitHub for the same?
Pawan Jain
Pawan Jainβ€’12mo ago
@Stephen Feel free to create a github issue and share in this post Team will priorities for sure
Stephen
StephenOPβ€’12mo ago
Alright I have identified few more issues like this. I will create and post
Stephen
StephenOPβ€’12mo ago
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...
Novu_Bot
Novu_Botβ€’12mo ago
@Stephen, you just advanced to level 3!
Pawan Jain
Pawan Jainβ€’12mo ago
Thanks Stephen
Stephen
StephenOPβ€’12mo ago
@Pawan Jain . I have one more usecase over here. I would like unsubscribe from already subscribed queries. Say I want to reset. Like I want to call just the removeQueries(). I'm about to raise a PR for this issue. Can I also add this new method as well with this PR ? I'm asking this because, In our app we provide a filter for filtering only the "unread" messages. So when user turns this filter ON we need to refetch new queries and remove the existing subscription.
BiswaViraj
BiswaVirajβ€’12mo ago
I will suggest you to create a different PR, with the new feature
Stephen
StephenOPβ€’12mo ago
Alright thanks @BiswaViraj
Stephen
StephenOPβ€’12mo ago
@BiswaViraj @Pawan Jain I have raised PR for this please review https://github.com/novuhq/novu/pull/5021
GitHub
fix: headless api client remove/refetch query scenarios by vichuste...
What change does this PR introduce? Here , I have fixed the issues over remove/refetch scenarios in Headless api methods Why was this change needed? In headless API we use a set of events like mar...
Want results from more Discord servers?
Add your server