Feat/progressive inbox scan #72
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
InboxWhiz/gmail-declutter-extension!72
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/progressive-inbox-scan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR resolves the performance issue where the extension would freeze when scanning very large inboxes (~500k emails).
It replaces the "all-at-once" email fetching mechanism with a progressive loading system that processes emails in batches.
This provides a much better user experience by preventing the UI from freezing and giving the user real-time feedback and control over the scanning process.
✨ Key Changes
BrowserEmailServicenow fetches emails in configurable batches to avoid blocking the main thread.FetchProgressBarcomponent has been added, which displays:AppProvidernow manages the state for fetch progress and cancellation.✅ Verification
All 37 existing Playwright UI tests were executed and passed successfully, confirming that these changes do not break existing functionality.
Pull Request Overview
This PR adds progressive loading functionality to display real-time progress when fetching email senders from Gmail, improving user experience during long-running operations.
Key changes:
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
test/ui/sidebar/progressiveLoading.spec.tstest/ui/sidebar/helpers.tssrc/presentation/providers/app_provider.tsxsrc/presentation/apps/sidebar/components/sendersContainer.tsxfetchProgressis availablesrc/presentation/apps/sidebar/components/fetchProgress.tsxsrc/presentation/apps/sidebar/components/fetchProgress.csssrc/data/services/browser_email_service.tssrc/data/repositories/mocks/mock_email_repo.tssrc/data/repositories/browser_email_repo.tssrc/data/content_scripts/content.ts💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -1,19 +1,33 @@import { Sender } from "../../domain/entities/sender";The
setProgressCallbackandcancelFetchmethods are added toBrowserEmailRepoandMockEmailRepobut are not part of theEmailRepointerface. This creates an inconsistent API where consumers need to check instance types or cast to use these methods. Consider adding these methods to theEmailRepointerface for a consistent contract across implementations.The comment says 'Process 10 pages at a time', but the batch processing logic appears to process pages sequentially within each batch (lines 252-278). The batches only add a 100ms delay between them. Consider clarifying whether this is truly batch processing or just sequential processing with periodic delays.
@ -0,0 +1,42 @@import React from "react";The
FetchProgressinterface is duplicated across multiple files (fetchProgress.tsx, browser_email_service.ts, and mock_email_repo.ts). Consider defining it once in a shared location, such as in the domain layer or a shared types file, and importing it where needed to maintain a single source of truth.@ -50,15 +54,25 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({>({});The progress callback is only set up for
MockEmailRepobut not forBrowserEmailRepo. This means the progress bar won't be displayed in production. ThesetProgressCallbackshould also be called on theBrowserEmailRepoinstance.@ -88,11 +103,19 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({}The
cancelFetchfunction only callscancelFetch()onMockEmailRepoinstances, but not onBrowserEmailRepo. This means cancellation won't work in production. The condition should check for both repository types or call the method unconditionally if it's added to the interface.@ -50,15 +54,25 @@ export const AppProvider: React.FC<{ children: React.ReactNode }> = ({>({});Accurate - I noticed the new UI changes do not show up when the extension is loaded up with a real Gmail inbox.
Please consider the comments left by Copilot