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

Duplicated notifications are possibly created in Cypress #2230

Closed
Silver-IT opened this issue Jul 19, 2024 · 4 comments · Fixed by #2227
Closed

Duplicated notifications are possibly created in Cypress #2230

Silver-IT opened this issue Jul 19, 2024 · 4 comments · Fixed by #2227

Comments

@Silver-IT
Copy link
Member

Problem

In this Cypress test, we can see the two notifications are same.
image

Actually, it is not allowed to create duplicated notification and we do this by comparing its hash.

[keys.ADD_NOTIFICATION] (state, notification: Notification) {
  if (state.items.some(item => item.hash === notification.hash)) {
    // We cannot throw here, as this code might be called from within a contract side effect.
    return console.error('This notification is already in the store.')
  }
  state.items.push(notification)
  // Sort items in chronological order, newest items first.
  state.items.sort(compareOnTimestamp)
}

I guess the reason might be the duplicated notification is created before the Vuex module notifications is cloned from the IndexedDB after login.

Solution

Fix it.

@Silver-IT
Copy link
Member Author

Or the reason could be the identityContractID which is inside the data could be different.

@Silver-IT
Copy link
Member Author

Having investigated more in detail, I have noticed that those two notifications are different ones. Just difference in period.
In my test the difference in period is just like the following.

The first one:  "2024-07-19T06:58:48.784Z"
The second one: "2024-07-19T06:57:26.630Z"

Also, I have noticed that it's related to the force change of distributionDate which is updated by forceDistributionDate function inside cy.giForceDistributionDateToNow().

@Silver-IT
Copy link
Member Author

So this means this is not a bug, and it's the picky situation which only happens in Cypress.

@Silver-IT
Copy link
Member Author

However, I will link this issue to the PR #2227 since I have added code to check notifications count there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant