don't call modify if database isn't changing

This commit is contained in:
Jonathan Lamothe 2020-03-12 03:19:27 -04:00
parent 7ba670948b
commit 25f887a5e8

View File

@ -221,12 +221,12 @@ scrollDown = scrollOffset %~ succ
-- | Loads the database
loadDatabase :: Action ()
loadDatabase = do
db <- gets (^.database)
dbFile <- dbSetup
db' <- liftIO $ catch
(fromMaybe db <$> decodeFileStrict dbFile)
(\(_ :: IOException) -> return db)
modify $ database .~ db'
liftIO
(catch
(decodeFileStrict dbFile)
(\(_ :: IOException) -> return Nothing))
>>= mapM_ (modify . (database .~))
-- | Saves the database
saveDatabase :: Action ()