summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-02 13:55:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-02 13:55:38 -0400
commita6e4283fed739207e3fd5a239ec71f7a71789259 (patch)
treefcc4b7100f8d518082386ebeffbf2bbe1da627a0 /Assistant
parentd2f975944380aab57047a9e84af620e15464fa15 (diff)
add slight delay in between sidebar updates, to avoid excessive churn
Tested and 0.01 seconds is not perceivable as a delay when interacting with the UI.
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/WebApp/SideBar.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Assistant/WebApp/SideBar.hs b/Assistant/WebApp/SideBar.hs
index a4b837897..4373b5a5b 100644
--- a/Assistant/WebApp/SideBar.hs
+++ b/Assistant/WebApp/SideBar.hs
@@ -20,6 +20,7 @@ import Utility.Yesod
import Yesod
import Data.Text (Text)
import qualified Data.Map as M
+import Control.Concurrent
sideBarDisplay :: Widget
sideBarDisplay = do
@@ -75,6 +76,13 @@ getSideBarR :: NotificationId -> Handler RepHtml
getSideBarR nid = do
waitNotifier alertNotifier nid
+ {- This 0.1 second delay avoids very transient notifications from
+ - being displayed and churning the sidebar unnecesarily.
+ -
+ - This needs to be below the level perceptable by the user,
+ - to avoid slowing down user actions like closing alerts. -}
+ liftIO $ threadDelay 100000
+
page <- widgetToPageContent sideBarDisplay
hamletToRepHtml $ [hamlet|^{pageBody page}|]