on develop help sign in
Merge remote-tracking branch 'origin/develop' into jsaddle
35894f7Ryan Trinkle
reflex-dom-core/src/Reflex/Dom/Main.hs+8
@@ -52,6 +52,14 @@ mainWidget w = withJSContextSingleton $ \jsSing -> do
52 body <- getBodyUnchecked doc
52 body <- getBodyUnchecked doc
53 attachWidget body jsSing w
53 attachWidget body jsSing w
54
54
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+
55--TODO: The x's should be unified here
63--TODO: The x's should be unified here
56{-# INLINABLE mainWidgetWithHead #-}
64{-# INLINABLE mainWidgetWithHead #-}
57mainWidgetWithHead :: (forall x. Widget x ()) -> (forall x. Widget x ()) -> JSM ()
65mainWidgetWithHead :: (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
354dynamicAttributesToModifyAttributesWithInitial :: (Ord k, PostBuild t m) => Map k Text -> Dynamic t (Map k Text) -> m (Event t (Map k (Maybe Text)))
354dynamicAttributesToModifyAttributesWithInitial :: (Ord k, PostBuild t m) => Map k Text -> Dynamic t (Map k Text) -> m (Event t (Map k (Maybe Text)))
355dynamicAttributesToModifyAttributesWithInitial attrs0 d = do
355dynamicAttributesToModifyAttributesWithInitial attrs0 d = do
356 postBuild <- getPostBuild
356 postBuild <- getPostBuild
357− let modificationsNeeded = flip pushAlways (align postBuild $ updated d) $ \case
357+ let modificationsNeeded = flip push (align postBuild $ updated d) $ \x -> do
358+ p <- case x of
358− This () -> do
359+ This () -> do
359− new <- sample $ current d
360+ new <- sample $ current d
360− return $ diffMap attrs0 new
361+ return $ diffMap attrs0 new
361− These () new -> return $ diffMap attrs0 new
362+ These () new -> return $ diffMap attrs0 new
362− That new -> do
363+ That new -> do
363− old <- sample $ current d
364+ old <- sample $ current d
364− return $ diffMap old new
365+ return $ diffMap old new
366+ return $ if Map.null p then Nothing else Just p
365 return modificationsNeeded
367 return modificationsNeeded
366
368
367--------------------------------------------------------------------------------
369--------------------------------------------------------------------------------
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,
92 -> (k -> v -> Event t v -> m a) -- ^ The row child element builder.
92 -> (k -> v -> Event t v -> m a) -- ^ The row child element builder.
93 -> 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
93 -> 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
94virtualList heightPx rowPx maxIndex i0 setI keyToIndex items0 itemsUpdate itemBuilder = do
94virtualList heightPx rowPx maxIndex i0 setI keyToIndex items0 itemsUpdate itemBuilder = do
95− let virtualH = fmap (mkVirtualHeight . (*) rowPx) maxIndex
95+ let virtualH = mkVirtualHeight <$> maxIndex
96 containerStyle = fmap mkContainer heightPx
96 containerStyle = fmap mkContainer heightPx
97 viewportStyle = fmap mkViewport heightPx
97 viewportStyle = fmap mkViewport heightPx
98 pb <- getPostBuild
98 pb <- getPostBuild