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 message thread pagination #5282
Comments
To fix the issue with unnecessary requests in message thread pagination, you need to adjust the logic in the
const fetchMoreRecords = () => {
const alreadyFetchedRecords = timelineThreads.length;
if (totalNumberOfThreads <= alreadyFetchedRecords) {
return; // Stop fetching more records
}
// Existing logic to fetch more records
}; This change ensures that additional data is only requested when the total number of threads exceeds the number of threads already fetched, effectively using the Referencestwentyhq/twenty/packages/twenty-front/src/modules/activities/emails/components/EmailThreads.tsx |
To address the issue of unnecessary requests for message thread pagination, you'll need to modify the logic within the
Here's a pseudo-code snippet to illustrate the concept: if ((currentPage * TIMELINE_THREADS_DEFAULT_PAGE_SIZE) < totalNumberOfThreads) {
fetchMoreRecords();
} else {
// All records have been fetched, do not make more requests
} This adjustment ensures that the component only requests additional pages when the total number of threads exceeds the number of threads already fetched, effectively reducing unnecessary network requests and improving the performance of the emails tab on detail pages. Referencestwentyhq/twenty/packages/twenty-front/src/modules/activities/emails/components/EmailThreads.tsx |
To address the issue of unnecessary requests in the pagination of message threads, you need to modify the logic in the
const hasMoreThreadsToFetch = timelineThreads.length < totalNumberOfThreads;
<FetchMoreLoader
loading={isFetchingMore || firstQueryLoading}
onLastRowVisible={hasMoreThreadsToFetch ? fetchMoreRecords : () => {}}
/> This approach ensures that additional network requests are only made when necessary, based on the actual count of available threads, improving the efficiency of data fetching on the emails tab. Referencestwentyhq/twenty/packages/twenty-front/src/modules/activities/emails/components/EmailThreads.tsx |
I'll look into this issue. Can you assign me to it? |
@orinamio Let's leave this one to someone else while you work on the others? Happy to assign it after. Thanks again!!! |
On a company or person's detail page, go to the emails tab.
You will see the frontend does two request to
GetTimelineThreadsFromCompanyId
.It seems it only stops doing request when it finds an empty array.
Instead, it should rely on the count returned in
totalNumberOfThreads
variables.If that count it inferior to the total number of records we ask for, then we already know we don't have to ask for a second page.
The text was updated successfully, but these errors were encountered: