- This error was still being thrown for a large number of accounts,
despite the fact that the N1-Snoozed category was being created
- This error was happening when adding a new account which did not already have a
snooze category in the backend:
- When the account is added the AccountStore triggers more than once,
causing the SnoozeStore to send more than one request to create the
same category. Any request after the first one will fail because the
category already exists
- The fix is not try to create a category unless the accounts have
actually changed
Summary:
- Also refactors the code a bit for testability and maintainability
- Fixes#1515
Test Plan: - Unit tests
Reviewers: evan, drew, bengotow
Reviewed By: bengotow
Differential Revision: https://phab.nylas.com/D2651