on develop help sign in
Cleanup console output of Reflex.Dom.Widget.Basic
48eed83Ryan Trinkle
src/Reflex/Dom/Widget/Basic.hs−16
@@ -155,7 +155,6 @@ widgetHold child0 newChild = do
155 return ()
155 return ()
156 return ()
156 return ()
157 addVoidAction $ ffor newChild $ \c -> do
157 addVoidAction $ ffor newChild $ \c -> do
158− liftIO $ putStrLn "Clearing widgetHold"
159 liftIO $ deleteBetweenExclusive startPlaceholder endPlaceholder
158 liftIO $ deleteBetweenExclusive startPlaceholder endPlaceholder
160 build c
159 build c
161 holdDyn result0 $ fmap fst newChildBuilt
160 holdDyn result0 $ fmap fst newChildBuilt
@@ -192,11 +191,9 @@ listWithKey vals mkChild = do
192 --TODO: Should we remove the parent from the DOM first to avoid reflows?
191 --TODO: Should we remove the parent from the DOM first to avoid reflows?
193 (newState, postBuild) <- flip runStateT (return ()) $ liftM (Map.mapMaybe id) $ iforM (align curState newVals) $ \k -> \case
192 (newState, postBuild) <- flip runStateT (return ()) $ liftM (Map.mapMaybe id) $ iforM (align curState newVals) $ \k -> \case
194 This ((_, (start, end)), _) -> do
193 This ((_, (start, end)), _) -> do
195− liftIO $ putStrLn "Deleting item"
196 liftIO $ deleteBetweenInclusive start end
194 liftIO $ deleteBetweenInclusive start end
197 return Nothing
195 return Nothing
198 That v -> do
196 That v -> do
199− liftIO $ putStrLn "Creating item"
200 Just df <- liftIO $ documentCreateDocumentFragment doc
197 Just df <- liftIO $ documentCreateDocumentFragment doc
201 (childResult, childPostBuild, childVoidAction) <- lift $ buildChild df k v
198 (childResult, childPostBuild, childVoidAction) <- lift $ buildChild df k v
202 let s = (childResult, childVoidAction)
199 let s = (childResult, childVoidAction)
@@ -208,13 +205,9 @@ listWithKey vals mkChild = do
208 liftIO $ nodeInsertBefore p (Just df) (Just placeholder)
205 liftIO $ nodeInsertBefore p (Just df) (Just placeholder)
209 return $ Just s
206 return $ Just s
210 These state _ -> do
207 These state _ -> do
211− liftIO $ putStrLn "Leaving item unchanged"
212 return $ Just state
208 return $ Just state
213− liftIO $ putStrLn "Triggering newChildren"
214− liftIO $ putStrLn . ("newChildrenTriggerRef is Just? " <>) . show . isJust =<< readRef newChildrenTriggerRef
215 runFrameWithTriggerRef newChildrenTriggerRef newState
209 runFrameWithTriggerRef newChildrenTriggerRef newState
216 postBuild
210 postBuild
217− liftIO $ putStrLn "Triggering newChildren done"
218 holdDyn Map.empty $ fmap (fmap (fst . fst)) newChildren
211 holdDyn Map.empty $ fmap (fmap (fst . fst)) newChildren
219
212
220listWithKey' :: forall t m k v a. (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))
213listWithKey' :: forall t m k v a. (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))
@@ -269,11 +262,8 @@ listWithKey' initialVals valsChanged mkChild = do
269 return $ Just s
262 return $ Just s
270 This state -> do -- No change
263 This state -> do -- No change
271 return $ Just state
264 return $ Just state
272− liftIO $ putStrLn "Triggering newChildren"
273− liftIO $ putStrLn . ("newChildrenTriggerRef is Just? " <>) . show . isJust =<< readRef newChildrenTriggerRef
274 runFrameWithTriggerRef newChildrenTriggerRef newState
265 runFrameWithTriggerRef newChildrenTriggerRef newState
275 postBuild
266 postBuild
276− liftIO $ putStrLn "Triggering newChildren done"
277 mapDyn (fmap (fst . fst)) children
267 mapDyn (fmap (fst . fst)) children
278
268
279--TODO: Something better than Dynamic t (Map k v) - we want something where the Events carry diffs, not the whole value
269--TODO: Something better than Dynamic t (Map k v) - we want something where the Events carry diffs, not the whole value
@@ -311,11 +301,9 @@ listViewWithKey' vals mkChild = do
311 --TODO: Should we remove the parent from the DOM first to avoid reflows?
301 --TODO: Should we remove the parent from the DOM first to avoid reflows?
312 (newState, postBuild) <- flip runStateT (return ()) $ liftM (Map.mapMaybe id) $ iforM (align curState newVals) $ \k -> \case
302 (newState, postBuild) <- flip runStateT (return ()) $ liftM (Map.mapMaybe id) $ iforM (align curState newVals) $ \k -> \case
313 This ((_, (start, end)), _) -> do
303 This ((_, (start, end)), _) -> do
314− liftIO $ putStrLn "Deleting item"
315 liftIO $ deleteBetweenInclusive start end
304 liftIO $ deleteBetweenInclusive start end
316 return Nothing
305 return Nothing
317 That v -> do
306 That v -> do
318− liftIO $ putStrLn "Creating item"
319 Just df <- liftIO $ documentCreateDocumentFragment doc
307 Just df <- liftIO $ documentCreateDocumentFragment doc
320 (childResult, childPostBuild, childVoidAction) <- lift $ buildChild df k v
308 (childResult, childPostBuild, childVoidAction) <- lift $ buildChild df k v
321 let s = (childResult, childVoidAction)
309 let s = (childResult, childVoidAction)
@@ -327,13 +315,9 @@ listViewWithKey' vals mkChild = do
327 liftIO $ nodeInsertBefore p (Just df) (Just placeholder)
315 liftIO $ nodeInsertBefore p (Just df) (Just placeholder)
328 return $ Just s
316 return $ Just s
329 These state _ -> do
317 These state _ -> do
330− liftIO $ putStrLn "Leaving item unchanged"
331 return $ Just state
318 return $ Just state
332− liftIO $ putStrLn "Triggering newChildren"
333− liftIO $ putStrLn . ("newChildrenTriggerRef is Just? " <>) . show . isJust =<< readRef newChildrenTriggerRef
334 runFrameWithTriggerRef newChildrenTriggerRef newState
319 runFrameWithTriggerRef newChildrenTriggerRef newState
335 postBuild
320 postBuild
336− liftIO $ putStrLn "Triggering newChildren done"
337 return $ fmap (fmap (fst . fst)) children
321 return $ fmap (fmap (fst . fst)) children
338
322
339--TODO: Deduplicate the various list*WithKey* implementations
323--TODO: Deduplicate the various list*WithKey* implementations