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

[Mailbox] Implemented server-side pagination #217

Merged
merged 1 commit into from
Nov 24, 2021

Conversation

ozsivanov
Copy link
Contributor

Code changes

  • Implemented server-side pagination for mailbox component
  • To keep pages the same size, I had to remove the filter that excluded threads without messages (most of these were from spam emails so we now exclude the spam folder as well
  • Removed unread_status prop from Mailbox
  • Removed unread prop from Email

License

I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@vercel
Copy link

vercel bot commented Nov 22, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nylas/components/72LUW9NxoJ5gP8ELXGu12EDFGg12
✅ Preview: https://components-git-oz-ch74056fixup-mailbox-pagination-nylas.vercel.app

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #74056: Mailbox component - unable to page past initial threads.

const queryKey = JSON.stringify(query);
if (!threadsMap[queryKey] && (query.component_id || query.access_token)) {
threadsMap[queryKey] = [await fetchThread(query)];
updateThreadSelection: (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO - revisit if this is needed

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this?

if (_this.all_threads) {
threads = _this.all_threads as Thread[];
if (_this.all_threads || !id) {
threads = (_this.all_threads as Thread[]) ?? [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO - paginate onmount

} else {
threads = (await MailboxStore.getThreads(query)) || [];
}
await updatedDisplayedThreads();
Copy link
Contributor

Choose a reason for hiding this comment

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

updatedDisplayedThreads did you mean updateDisplayedThreads ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great catch, not sure how this isn't causing any errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh I see, it's like this everywhere - needs to be renamed 👍

Copy link
Contributor

@pooja169usp pooja169usp left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏽

@ozsivanov ozsivanov force-pushed the oz/ch74056/fixup-mailbox-pagination branch from d685056 to be1b155 Compare November 24, 2021 22:12
@ozsivanov ozsivanov merged commit c7970e0 into main Nov 24, 2021
@ozsivanov ozsivanov deleted the oz/ch74056/fixup-mailbox-pagination branch November 24, 2021 22:31
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.

3 participants