on develop help sign in
Merge pull request #61 from themoritz/fix-listWithKeyShallowDiff

consider initialVals when calculating sentVals in listWithKeyShallowDiff

commite8b7d31fd2b6a8173e51096b7591ec346e33ad85 authorRyan Trinkle <ryan.trinkle@gmail.com> dateTue 31 May 2016, 16:33 (10 years ago) parent946ab0b8c6bacd
1 file changed+1−1
src/Reflex/Dom/Widget/Basic.hs+1−1
src/Reflex/Dom/Widget/Basic.hs+1−1
@@ -202,7 +202,7 @@ listWithKey' = listWithKeyShallowDiff
202202listWithKeyShallowDiff :: (Ord k, MonadWidget t m) => Map k v -> Event t (Map k (Maybe v)) -> (k -> v -> Event t v -> m a) -> m (Dynamic t (Map k a))
203203listWithKeyShallowDiff initialVals valsChanged mkChild = do
204204 let childValChangedSelector = fanMap $ fmap (Map.mapMaybe id) valsChanged
205− sentVals <- foldDyn (flip applyMap) Map.empty $ fmap (fmap (fmap (\_ -> ()))) valsChanged
205+ sentVals <- foldDyn (flip applyMap) (() <$ initialVals) $ fmap (fmap (fmap (\_ -> ()))) valsChanged
206206 let relevantDiff diff _ = case diff of
207207 Nothing -> Just Nothing -- Even if we let a Nothing through when the element doesn't already exist, this doesn't cause a problem because it is ignored
208208 Just _ -> Nothing -- We don't want to let spurious re-creations of items through