From cb3e2abade4a0aa1ad13f4aa1632b1e05af4d29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 2 Aug 2026 15:42:34 +0200 Subject: Use cached values for shared state lookups --- main/Main.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'main/Main.hs') 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 -- cgit v1.2.3