diff --git a/App.js b/App.js index fbd5b62..4021b41 100644 --- a/App.js +++ b/App.js @@ -15,6 +15,9 @@ persist('@mangaStoreKey', appStore, { 'mangas', 'favorites' ] +}).then(() => { + // fetch chapters on app load so that numNewUnread is updated + appStore.loadFavoritesChapters() }) const App = () => ( diff --git a/models/models.js b/models/models.js index 186ea82..5e748f7 100644 --- a/models/models.js +++ b/models/models.js @@ -90,6 +90,10 @@ const AppModel = types.model('App', { self.favorites.splice(self.favorites.findIndex((elem) => { return elem === self.selectedManga }), 1) + }, + + loadFavoritesChapters () { + self.favorites.forEach((favorite) => favorite.loadChapters()) }} })