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

fix(notification-center,widget): infinite scroll issue #5371

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

LetItRock
Copy link
Contributor

@LetItRock LetItRock commented Apr 5, 2024

What change does this PR introduce?

Fixes the issue introduced in: #5019, with not scrollable parent component.
Fixes the Widget test for the infinite scroll which was always passing, and makes sure that the scroll event is triggered on the scrollable element.

Why was this change needed?

Other information (Screenshots)

Screen.Recording.2024-04-05.at.22.06.21.mov
Screen.Recording.2024-04-05.at.22.28.59.mov

Copy link

linear bot commented Apr 5, 2024

@LetItRock LetItRock self-assigned this Apr 5, 2024
Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit e1a0f7e
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/66105fb142bea8000884912c
😎 Deploy Preview https://deploy-preview-5371--dev-web-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for novu-design ready!

Name Link
🔨 Latest commit e1a0f7e
🔍 Latest deploy log https://app.netlify.com/sites/novu-design/deploys/66105fb1f92d6d00081578ab
😎 Deploy Preview https://deploy-preview-5371--novu-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for novu-design ready!

Name Link
🔨 Latest commit d22f05f
🔍 Latest deploy log https://app.netlify.com/sites/novu-design/deploys/66105fbc7573080008489997
😎 Deploy Preview https://deploy-preview-5371--novu-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -171,11 +171,12 @@ describe('Notifications List', function () {
cy.getByTestId('unseen-count-label').should('contain', '99+');
});

it('pagination check', async function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of async this test was always passing, no matter of the body results

cy.wait('@getNotificationsFirstPage');
cy.task('createNotifications', {
organizationId: this.session.organization._id,
enumerate: true,
ordered: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test verifies notifications in the order, so I've added the option to create notifications ordered (trigger with a small delay after)

@@ -206,5 +207,5 @@ describe('Notifications List', function () {
});

function scrollToBottom() {
cy.getByTestId('notifications-scroll-area').get('.infinite-scroll-component').scrollTo('bottom');
cy.getByTestId('notifications-scroll-area').scrollTo('bottom', { ensureScrollable: true });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensureScrollable ensures that the target element is scrollable element, otherwise the test will fail

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This is helpful context in the code‏

@@ -47,4 +47,5 @@ export function NotificationsList({

const notificationsListCss = css`
height: 400px;
overflow-y: auto;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix... the InfiniteScroll component has a prop scrollableTarget="notifications-list" which points to the parent element and it should be a scrollable element otherwise the infinite scroll won't work

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit d22f05f
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/66105fbc769d110008becc38
😎 Deploy Preview https://deploy-preview-5371--dev-web-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@antonjoel82 antonjoel82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

@@ -206,5 +207,5 @@ describe('Notifications List', function () {
});

function scrollToBottom() {
cy.getByTestId('notifications-scroll-area').get('.infinite-scroll-component').scrollTo('bottom');
cy.getByTestId('notifications-scroll-area').scrollTo('bottom', { ensureScrollable: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This is helpful context in the code‏

@LetItRock LetItRock merged commit 8ab6ff5 into next Apr 5, 2024
31 checks passed
@LetItRock LetItRock deleted the nv-3634-fix-nc-scroll branch April 5, 2024 21:18
LetItRock added a commit that referenced this pull request Apr 5, 2024
fix(notification-center,widget): infinite scroll issue
@SokratisVidros
Copy link
Contributor

Nicely done @LetItRock for the quick fix. We can take the fix a step further and hide the scrollbar all together while scrolling giving a more polished feeling to the UI especially in non OS devices

/* Hide scrollbar for Chrome, Safari and Opera */
.example::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.example {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}```

LetItRock added a commit that referenced this pull request Apr 15, 2024
fix(notification-center,widget): infinite scroll issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants