Skip to content

Comments

Introduced Infinite Scroll using Virtua#1059

Merged
BlankParticle merged 13 commits intoMail-0:stagingfrom
inline-arc:main
May 25, 2025
Merged

Introduced Infinite Scroll using Virtua#1059
BlankParticle merged 13 commits intoMail-0:stagingfrom
inline-arc:main

Conversation

@inline-arc
Copy link
Contributor

@inline-arc inline-arc commented May 24, 2025

Description

Introduces Infinite Scroll using [Virtua] the feature refer requested from https://0email.featurebase.app/p/automatically-load-more-mail-on-scroll the code removes the load more button and replace with an scroll for more threads fetched, this may effect the overall performance of product need permission to revamp the code breaking changes for component optimal code create a Components to mount and dismount. ik what the code refers and would like get review of possible merge


Type of Change

Please delete options that are not relevant.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature with breaking changes)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • 🔒 Security enhancement
  • ⚡ Performance improvement

Areas Affected

Please check all that apply:

  • Email Integration (Gmail, IMAP, etc.)
  • User Interface/Experience
  • Authentication/Authorization
  • Data Storage/Management
  • API Endpoints
  • Documentation
  • Testing Infrastructure
  • Development Workflow
  • Deployment/Infrastructure

Testing Done

Describe the tests you've done:

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • Cross-browser testing (if UI changes)
  • Mobile responsiveness verified (if UI changes)

Security Considerations

For changes involving data or authentication:

  • No sensitive data is exposed
  • Authentication checks are in place
  • Input validation is implemented
  • Rate limiting is considered (if applicable)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in complex areas
  • I have updated the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix/feature works
  • All tests pass locally
  • Any dependent changes are merged and published

Additional Notes

Add any other context about the pull request here.

Screenshots/Recordings

Add screenshots or recordings here if applicable.


By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.

Summary by CodeRabbit

  • New Features
    • Introduced automatic infinite scrolling in the mail list, allowing more messages to load as you scroll down.
  • Style
    • Updated the mail list container to be scrollable for a smoother browsing experience.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 24, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The MailList component was updated to replace the manual "Load More" button for pagination with an automatic infinite scroll mechanism. This change introduces a scroll event listener that loads additional messages when the user scrolls near the bottom of the list, removing the need for manual interaction.

Changes

File(s) Change Summary
apps/mail/components/mail/mail-list.tsx Removed manual "Load More" button and callback; added infinite scroll via VList's onScrollEnd; replaced button with loading spinner during fetch; preserved loading and pagination logic internally.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MailList
    participant DataSource

    User->>MailList: Scrolls mail list
    MailList->>MailList: Detects scroll near bottom (onScrollEnd)
    MailList->>DataSource: loadMore()
    DataSource-->>MailList: Returns next page of messages
    MailList->>User: Renders additional messages
Loading

Possibly related PRs

  • switch to react-virtuoso #479: Both PRs modify the MailList component's pagination and scrolling logic, but this related PR switches to the react-virtuoso library for rendering and scrolling.
  • fixing the virtual mail-list #475: Both PRs change the MailList component's pagination and rendering logic, with the related PR also introducing react-virtuoso and memoization.

Suggested reviewers

  • nizzyabi
  • MrgSub

Poem

A scroll, a hop, no button in sight,
Mails now appear as you scroll through the night.
No more to click—just glide and see,
The inbox grows endlessly, rabbit with glee!
🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/mail/components/mail/mail-list.tsx (1)

550-558: LGTM! Clean hook destructuring with minor type casting question.

The destructuring of the useThreads hook is well-organized and includes all necessary state variables for infinite scroll functionality.

Consider whether the explicit type casting on line 558 is necessary:

-// Ensure items are of type ParsedMessage[]
-const parsedItems: ParsedMessage[] = (items as ParsedMessage[]);

If the useThreads hook already returns properly typed items, this casting may be redundant. You could verify the hook's return type to determine if this line can be removed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 592d699 and e055398.

📒 Files selected for processing (1)
  • apps/mail/components/mail/mail-list.tsx (4 hunks)
🔇 Additional comments (4)
apps/mail/components/mail/mail-list.tsx (4)

594-607: Excellent scroll handler implementation with proper safeguards.

The scroll detection logic is well-implemented with appropriate checks for loading states and boundary conditions. The 200px threshold provides a good user experience by starting the next page load before reaching the absolute bottom.


610-633: Outstanding event listener setup with proper performance optimization.

The scroll event handling demonstrates excellent practices:

  • requestAnimationFrame throttling prevents excessive function calls
  • Proper cleanup of event listeners prevents memory leaks
  • Initial scroll check on mount handles edge cases where content is already scrollable
  • The ticking flag ensures only one animation frame request is pending

803-803: Essential CSS update for scroll functionality.

Adding overflow-y-auto is crucial for enabling the scroll behavior that triggers the infinite loading mechanism.


777-784:

Details

❓ Verification inconclusive

Verify complete removal of "Load More" button.

The VList renderer looks clean, but I want to ensure the old "Load More" button was completely removed from the codebase.


🏁 Script executed:

#!/bin/bash
# Description: Verify that "Load More" button references have been completely removed
# Expected: No remaining references to load more button rendering in mail components

echo "Searching for Load More button references..."
rg -i "load.?more" --type tsx --type ts -A 3 -B 3

echo -e "\nSearching for button-related pagination..."
rg -i "(loadmore|load_more)" --type tsx --type ts -A 3 -B 3

echo -e "\nSearching for handleLoadMore references..."
rg "handleLoadMore" --type tsx --type ts -A 3 -B 3

Length of output: 549


#!/bin/bash
# Re-verify removal of "Load More" references using file globbing

echo "Searching for 'Load More' text in .ts and .tsx files..."
rg -i "load.?more" -g "*.ts" -g "*.tsx" -A 3 -B 3 || true

echo -e "\nSearching for 'loadmore' or 'load_more' in .ts and .tsx files..."
rg -i "(loadmore|load_more)" -g "*.ts" -g "*.tsx" -A 3 -B 3 || true

echo -e "\nSearching for handleLoadMore references in .ts and .tsx files..."
rg "handleLoadMore" -g "*.ts" -g "*.tsx" -A 3 -B 3 || true

Confirm removal of “Load More” references

I ran automated searches across *.ts and *.tsx files and didn’t find any remaining “Load More” or handleLoadMore occurrences. However, please manually verify that no remnants remain elsewhere:

• Tests and fixtures (e.g. tests or *.spec.tsx)
• Storybook stories or examples
• Pagination utilities or helper modules
• Localization/translation files

Once you’ve confirmed there are no lingering references, we can consider this fully resolved.

@nizzyabi
Copy link
Collaborator

Description

Introduces Infinite Scroll using [Virtua] the feature refer requested from https://0email.featurebase.app/p/automatically-load-more-mail-on-scroll the code removes the load more button and replace with an scroll for more threads fetched, this may effect the overall performance of product need permission to revamp the code breaking changes for component optimal code create a Components to mount and dismount. ik what the code refers and would like get review of possible merge

Type of Change

Please delete options that are not relevant.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature with breaking changes)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • 🔒 Security enhancement
  • ⚡ Performance improvement

Areas Affected

Please check all that apply:

  • Email Integration (Gmail, IMAP, etc.)
  • User Interface/Experience
  • Authentication/Authorization
  • Data Storage/Management
  • API Endpoints
  • Documentation
  • Testing Infrastructure
  • Development Workflow
  • Deployment/Infrastructure

Testing Done

Describe the tests you've done:

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • Cross-browser testing (if UI changes)
  • Mobile responsiveness verified (if UI changes)

Security Considerations

For changes involving data or authentication:

  • No sensitive data is exposed
  • Authentication checks are in place
  • Input validation is implemented
  • Rate limiting is considered (if applicable)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in complex areas
  • I have updated the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix/feature works
  • All tests pass locally
  • Any dependent changes are merged and published

Additional Notes

Add any other context about the pull request here.

Screenshots/Recordings

Add screenshots or recordings here if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.

Summary by CodeRabbit

  • New Features

    • Introduced automatic infinite scrolling in the mail list, allowing more messages to load as you scroll down.
  • Style

    • Updated the mail list container to be scrollable for a smoother browsing experience.

hey hey! can you screen record the infinite scroll? id love to check it out!

@inline-arc
Copy link
Contributor Author

Hey @nizzyabi Here is the screen record you asked for, Hope this help :)

Recording.2025-05-25.012419.mp4

@nizzyabi
Copy link
Collaborator

amazing! thanks. @MrgSub @BlankParticle can you review

Copy link
Contributor

@BlankParticle BlankParticle left a comment

Choose a reason for hiding this comment

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

needs changes

@inline-arc
Copy link
Contributor Author

@BlankParticle everything oky ? now with loader the UX and typo fixed review

Comment on lines 592 to 589

useEffect(() => {
const parent = parentRef.current;
if (!parent) return;

let ticking = false;
const onScroll = () => {
if (!ticking) {
window.requestAnimationFrame(() => {
ticking = false;
});
ticking = true;
}
};

parent.addEventListener('scroll', onScroll);


return () => {
parent.removeEventListener('scroll', onScroll);
};
}, []);

Copy link
Contributor

Choose a reason for hiding this comment

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

i dont think this effect is doing anything?

Comment on lines 826 to 832
itemSize={50}
onScroll={(offset) => {
if (parentRef.current) {
parentRef.current.scrollTop = offset;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

onScroll callback is not needed to set the scrollTop, the list just scrolls automatically, why do we need to set it? I think you can just remove the callback, check if only having scrollEnd works fine.

why added itemSize? it works without it

@inline-arc inline-arc requested a review from BlankParticle May 25, 2025 12:26
@BlankParticle BlankParticle changed the base branch from main to staging May 25, 2025 12:30
@BlankParticle BlankParticle force-pushed the main branch 2 times, most recently from a8ba39c to 771e17e Compare May 25, 2025 12:37
@BlankParticle BlankParticle merged commit 3e226d5 into Mail-0:staging May 25, 2025
1 of 2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jul 15, 2025
34 tasks
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 this pull request may close these issues.

4 participants