don't call modify if database isn't changing
This commit is contained in:
parent
7ba670948b
commit
25f887a5e8
|
@ -221,12 +221,12 @@ scrollDown = scrollOffset %~ succ
|
||||||
-- | Loads the database
|
-- | Loads the database
|
||||||
loadDatabase :: Action ()
|
loadDatabase :: Action ()
|
||||||
loadDatabase = do
|
loadDatabase = do
|
||||||
db <- gets (^.database)
|
|
||||||
dbFile <- dbSetup
|
dbFile <- dbSetup
|
||||||
db' <- liftIO $ catch
|
liftIO
|
||||||
(fromMaybe db <$> decodeFileStrict dbFile)
|
(catch
|
||||||
(\(_ :: IOException) -> return db)
|
(decodeFileStrict dbFile)
|
||||||
modify $ database .~ db'
|
(\(_ :: IOException) -> return Nothing))
|
||||||
|
>>= mapM_ (modify . (database .~))
|
||||||
|
|
||||||
-- | Saves the database
|
-- | Saves the database
|
||||||
saveDatabase :: Action ()
|
saveDatabase :: Action ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user