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.
This commit is contained in:
Joey Hess 2012-08-02 13:55:38 -04:00
parent d2f9759443
commit a6e4283fed

View file

@ -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}|]