feat: add new plugin ui.rerenderFetchedEmails method

This commit is contained in:
Paulhenry Saux
2026-07-22 13:39:21 +02:00
parent 0e47c3b039
commit 07c473e057
4 changed files with 22 additions and 1 deletions
+12
View File
@@ -757,6 +757,18 @@ function findTrashMailbox(
});
}
// Plugin re-render for already fetched emails.
// Plugins can trigger: window.dispatchEvent(new Event('plugin:rerender-fetched-emails'))
if (typeof window !== 'undefined') {
window.addEventListener('plugin:rerender-fetched-emails', async () => {
const state = useEmailStore.getState();
const transformed = await emailHooks.onEmailsFetched.transform(state.emails);
useEmailStore.setState({
emails: annotateScheduledEmails(transformed, state.scheduledSubmissionByEmailId),
});
});
}
export const useEmailStore = create<EmailStore>((set, get) => ({
emails: [],
mailboxes: [],