There was an error while loading. Please reload this page.
1 parent 10aa4e1 commit 3fe718cCopy full SHA for 3fe718c
1 file changed
src/Main.hs
@@ -19,6 +19,7 @@
19
module Main where
20
----------------------------------------------------------------------------
21
import Control.Category ((.))
22
+import Control.Monad
23
import qualified Data.IntMap as IM
24
import Data.IntMap (IntMap)
25
import Data.Bool
@@ -120,10 +121,11 @@ updateModel = \case
120
121
io_ $ consoleLog (S.ms time)
122
Add -> do
123
value <- use field
- field .= mempty
124
- uid += 1
125
- nextId <- use uid
126
- entries %= IM.insert nextId (newEntry value)
+ unless (S.null value) $ do
+ field .= mempty
+ uid += 1
127
+ nextId <- use uid
128
+ entries %= IM.insert nextId (newEntry value)
129
UpdateField str -> do
130
field .= str
131
EditingEntry idx isEditing ->
0 commit comments