decouple message id counter from actions

Actions should be pure functions for ease of testing.
This commit is contained in:
David Lechner
2021-01-21 12:37:29 -06:00
parent 0333fa51c0
commit f186e6414d
9 changed files with 101 additions and 70 deletions
+8 -1
View File
@@ -18,10 +18,17 @@ import reportWebVitals from './reportWebVitals';
import rootSaga from './sagas';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
import { i18nManager } from './settings/i18n';
import { createCountFunc } from './utils/iter';
const toaster = I18nToaster.create(i18nManager);
const sagaMiddleware = createSagaMiddleware({ context: { notification: { toaster } } });
const sagaMiddleware = createSagaMiddleware({
context: {
nextMessageId: createCountFunc(),
notification: { toaster },
},
});
// TODO: add runtime option or filter - logger affects firmware flash performance
const loggerMiddleware = createLogger({ predicate: () => false });