Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: Headless API issue over removing and refetching queries. #5011

Closed
2 tasks done
vichustephen opened this issue Dec 21, 2023 · 2 comments · Fixed by #5021
Closed
2 tasks done

🐛 Bug Report: Headless API issue over removing and refetching queries. #5011

vichustephen opened this issue Dec 21, 2023 · 2 comments · Fixed by #5021
Labels
bug Something isn't working headless

Comments

@vichustephen
Copy link
Contributor

vichustephen commented Dec 21, 2023

📜 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 component with novu we have found some issues. When we make changes to notifications it should refetch the queries at certain events and remove them for certain events.

  1. When a single notification is deleted , the queries to refetch the notifications are removed.
  2. When we receive a new notification , the queries are removed.
  3. When all notifications are removed . the queries are refetched.

There are few more i'll update it below.

Though all of these events works perfectly in Notification Center Component.

👟 Reproduction steps

Implement the headless API with infinite scrolling and implement the above mentioned methods so you can observe the behaviour. Compare with Novu Notification Center component. In there these methods are implemented perfectly.

👍 Expected behavior

  1. When a single notification is deleted , the queries must be refetched.
  2. When we receive a new notification , the queries must be refetched.
  3. When all notifications are removed . the queries must be removed.
  4. When unseenCount changed , the queries must not be removed.
  5. When unreadCount changed, the queries must not be removed.

👎 Actual Behavior with Screenshots

  1. Here I have a screenshot of API calls in debugger. I have used markAs method so it refetched the queries and its correct.

image

  1. Now here I have deleted a single notification and it has not refetched any queries and instead removed them. Hence even the next subsequent calls are not happening. Like when I call the markAs method, it is not refetching since the queries are already removed.

image

Ok now here I will post the code comparision screenshots between Notification Center Component and Headless API.

  1. Here is code for delete single notification in Notification Center Component:
    image

Here is the code on Headless API:

image

  1. Here is the code for unseenCount change in Notification Center Component:

image

Here is the code on Headless API:
image

Novu version

0.21.0

npm version

No response

node version

No response

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

Yes I am willing to submit a PR!

Copy link

linear bot commented Dec 21, 2023

@scopsy scopsy added bug Something isn't working headless labels Dec 21, 2023 — with Linear
@vichustephen
Copy link
Contributor Author

Hi @scopsy , @jainpawan21 , I have raised raised PR for this issue : #5021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working headless
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants