novu icon indicating copy to clipboard operation
novu copied to clipboard

🐛 Bug Report: Pagination Issue in React component

Open singhgulshan opened this issue 2 years ago • 2 comments

📜 Description

Page number not reset to 0 after calling refetch method of`useNotification.

👟 Reproduction steps

Call fetchNextPage several times, After that call refetch after that again call fetchNextPage. Page will be same as old page number.

👍 Expected behavior

refetch should also reset the page number.

👎 Actual Behavior with Screenshots

Calling the last page which was called earlier. Screenshot 2022-11-22 at 5 52 49 PM

💻 Operating system

MacOS

🤖 Node Version

18.6.0

📃 Provide any additional context for the Bug.

No response

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

  • [X] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

No response

singhgulshan avatar Nov 22 '22 12:11 singhgulshan

Hey, @singhgulshan, I could not reproduce that behavior, though whenever I call refetch, it does go to page 0. It seems right in most cases, but let's say a user marks a notification as seen in a page different from 0. The markAsSeen method is called and the notification box refetches the data so the user can be sure he marked that notification as seen. The issue is that it resets the page to 0 automatically, and I believe that is where the problem is situated.

It would be great if Novu provided a way for us to access a specific page on refetch. Something like this:

function refetch({ page: number }) {
  // Refetches on desired page
}

JoaoMagnago avatar Dec 22 '22 14:12 JoaoMagnago

@JoaoMagnago Would you mind to create a feature request for this?

jainpawan21 avatar Jan 15 '23 19:01 jainpawan21

@JoaoMagnago Would you mind to create a feature request for this?

Hey, @jainpawan21!

Sorry for the delay. I have just created a Feature Request regarding that matter here.

Thank you for the attention and support.

JoaoMagnago avatar Jan 20 '23 14:01 JoaoMagnago

Thank you @JoaoMagnago will close this one here in favor of the newly created one.

scopsy avatar Feb 05 '23 17:02 scopsy