summaryrefslogtreecommitdiff
path: root/main/Main.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-02 15:42:34 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-08-05 21:55:55 +0200
commitcb3e2abade4a0aa1ad13f4aa1632b1e05af4d29a (patch)
tree5ee32f2e21b5fa504bdb1d30a717dffa4f17ac34 /main/Main.hs
parent0efd90e5f01996ceb01f5a2889f9e2986322c371 (diff)
Use cached values for shared state lookups
Diffstat (limited to 'main/Main.hs')
-rw-r--r--main/Main.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/Main.hs b/main/Main.hs
index 604d58f..654c04b 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -467,7 +467,7 @@ interactiveLoop st opts = withTerminal commandCompletion $ \term -> do
chatroomSetVar <- liftIO $ newEmptyMVar
let autoSubscribe = optChatroomAutoSubscribe opts
- chatroomList = fromSetBy (comparing roomStateData) . lookupSharedValue . lsShared . headObject $ erebosHead
+ chatroomList = fromSetBy (comparing roomStateData) . lookupSharedValueH $ erebosHead
watched <- if isJust autoSubscribe || any roomStateSubscribe chatroomList
then do
fmap Just $ liftIO $ watchChatroomsForCli tui extPrintLn erebosHead
@@ -1042,7 +1042,7 @@ cmdContacts :: Command
cmdContacts = do
args <- words <$> asks ciLine
ehead <- gets csHead
- let contacts = fromSetBy (comparing contactName) $ lookupSharedValue $ lsShared $ headObject ehead
+ let contacts = fromSetBy (comparing contactName) $ lookupSharedValueH ehead
verbose = "-v" `elem` args
set <- asks ciSetContextOptions
set WatchContacts $ map SelectedContact contacts
@@ -1075,7 +1075,7 @@ cmdInviteContact = do
_ -> liftIO $ do
setPrompt term "Name: "
getInputLine term $ KeepPrompt . maybe T.empty T.pack
- (lookupSharedValue . lsShared . fromStored <$> getLocalHead) >>= \case
+ lookupSharedValueM >>= \case
Just (self :: ComposedIdentity) -> do
invite <- createSingleContactInvite name
dgst : _ <- return $ refDigest . storedRef <$> idDataF self
@@ -1163,7 +1163,7 @@ cmdDetails = do
NoContext -> cmdPutStrLn "nothing selected"
where
printContactOrIdentityDetails cid = do
- contacts <- fromSetBy (comparing contactName) . lookupSharedValue . lsShared . fromStored <$> getLocalHead
+ contacts <- fromSetBy (comparing contactName) <$> lookupSharedValueM
case find (maybe False (sameIdentity cid) . contactIdentity) contacts of
Just contact -> printContactDetails contact
Nothing -> printIdentityDetails cid