on develop help sign in
Merge remote-tracking branch 'origin/develop' into jsaddle
commit35894f78228b555f0c4b9498c1f9f92643c8511c authorRyan Trinkle <ryan.trinkle@gmail.com> dateMon 1 May 2017, 10:56 (10 years ago) parent0b3e62b773de9b
3 files changed+19−9
reflex-dom-core/src/Reflex/Dom/Main.hs+8 reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+10−8 reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs+1−1
reflex-dom-core/src/Reflex/Dom/Main.hs+8
@@ -52,6 +52,14 @@ mainWidget w = withJSContextSingleton $ \jsSing -> do
5252 body <- getBodyUnchecked doc
5353 attachWidget body jsSing w
5454
55+{-# INLINABLE mainWidget' #-}
56+-- | Warning: `mainWidget'` is provided only as performance tweak. It is expected to disappear in future releases.
57+mainWidget' :: Widget () () -> IO ()
58+mainWidget' w = withJSContextSingleton $ \jsSing -> do
59+ doc <- currentDocumentUnchecked
60+ body <- getBodyUnchecked doc
61+ attachWidget body jsSing w
62+
5563--TODO: The x's should be unified here
5664{-# INLINABLE mainWidgetWithHead #-}
5765mainWidgetWithHead :: (forall x. Widget x ()) -> (forall x. Widget x ()) -> JSM ()
reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs+10−8
@@ -354,14 +354,16 @@ dynamicAttributesToModifyAttributes = dynamicAttributesToModifyAttributesWithIni
354354dynamicAttributesToModifyAttributesWithInitial :: (Ord k, PostBuild t m) => Map k Text -> Dynamic t (Map k Text) -> m (Event t (Map k (Maybe Text)))
355355dynamicAttributesToModifyAttributesWithInitial attrs0 d = do
356356 postBuild <- getPostBuild
357− let modificationsNeeded = flip pushAlways (align postBuild $ updated d) $ \case
358− This () -> do
359− new <- sample $ current d
360− return $ diffMap attrs0 new
361− These () new -> return $ diffMap attrs0 new
362− That new -> do
363− old <- sample $ current d
364− return $ diffMap old new
357+ let modificationsNeeded = flip push (align postBuild $ updated d) $ \x -> do
358+ p <- case x of
359+ This () -> do
360+ new <- sample $ current d
361+ return $ diffMap attrs0 new
362+ These () new -> return $ diffMap attrs0 new
363+ That new -> do
364+ old <- sample $ current d
365+ return $ diffMap old new
366+ return $ if Map.null p then Nothing else Just p
365367 return modificationsNeeded
366368
367369--------------------------------------------------------------------------------
reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs+1−1
@@ -92,7 +92,7 @@ virtualList :: forall t m k v a. (DomBuilder t m, PostBuild t m, MonadHold t m,
9292 -> (k -> v -> Event t v -> m a) -- ^ The row child element builder.
9393 -> m (Dynamic t (Int, Int), Dynamic t (Map k a)) -- ^ A tuple containing: a 'Dynamic' of the index (based on the current scroll position) and number of items currently being rendered, and the 'Dynamic' list result
9494virtualList heightPx rowPx maxIndex i0 setI keyToIndex items0 itemsUpdate itemBuilder = do
95− let virtualH = fmap (mkVirtualHeight . (*) rowPx) maxIndex
95+ let virtualH = mkVirtualHeight <$> maxIndex
9696 containerStyle = fmap mkContainer heightPx
9797 viewportStyle = fmap mkViewport heightPx
9898 pb <- getPostBuild