fix: preserve list scroll position when tagging an email

This commit is contained in:
Linus Rath
2026-05-01 17:18:11 +02:00
parent 7822a363dd
commit e9c9be84ad
2 changed files with 16 additions and 5 deletions
+12
View File
@@ -85,6 +85,7 @@ interface EmailStore {
clearSearchFilters: () => void;
toggleAdvancedSearch: () => void;
toggleStar: (client: IJMAPClient, emailId: string) => Promise<void>;
setEmailKeywordsLocal: (emailId: string, keywords: Record<string, boolean>) => void;
// Batch operations
batchMarkAsRead: (client: IJMAPClient, read: boolean) => Promise<void>;
@@ -1057,6 +1058,17 @@ export const useEmailStore = create<EmailStore>((set, get) => ({
}
},
setEmailKeywordsLocal: (emailId, keywords) => {
set((state) => ({
emails: state.emails.map(e =>
e.id === emailId ? { ...e, keywords: { ...keywords } } : e
),
selectedEmail: state.selectedEmail?.id === emailId
? { ...state.selectedEmail, keywords: { ...keywords } }
: state.selectedEmail,
}));
},
// Batch operations
batchMarkAsRead: async (client, read) => {
const { selectedEmailIds, emails, mailboxes } = get();