@@ -742,8 +742,11 @@ hoistTraverseWithKeyWithAdjust base mapPatch updateChildUnreadiness applyDomUpda
742 haveEverBeenReady <- liftIO $ newIORef False
742 haveEverBeenReady <- liftIO $ newIORef False
743 placeholders <- liftIO $ newIORef $ error "placeholders not yet initialized"
743 placeholders <- liftIO $ newIORef $ error "placeholders not yet initialized"
744 lastPlaceholderRef <- liftIO $ newIORef $ error "lastPlaceholderRef not yet initialized"
744 lastPlaceholderRef <- liftIO $ newIORef $ error "lastPlaceholderRef not yet initialized"
745+ let applyDomUpdate p = do
745− let applyDomUpdate = applyDomUpdate_ placeholders lastPlaceholderRef
746+ applyDomUpdate_ placeholders lastPlaceholderRef p
748+ liftIO $ writeIORef pendingChange $! mempty
746− let markSelfReady = do
749+ markSelfReady = do
747 liftIO (readIORef haveEverBeenReady) >>= \case
750 liftIO (readIORef haveEverBeenReady) >>= \case
748 True -> return ()
751 True -> return ()
749 False -> do
752 False -> do
@@ -767,7 +770,6 @@ hoistTraverseWithKeyWithAdjust base mapPatch updateChildUnreadiness applyDomUpda
767 liftIO $ writeIORef pendingChange (newUnready, p)
770 liftIO $ writeIORef pendingChange (newUnready, p)
768 when (DMap.null newUnready) $ do
771 when (DMap.null newUnready) $ do
769 applyDomUpdate p
772 applyDomUpdate p
771 (children0, children') <- ImmediateDomBuilderT $ lift $ base (\k v -> drawChildUpdate initialEnv markChildReady $ f k v) dm0 dm'
773 (children0, children') <- ImmediateDomBuilderT $ lift $ base (\k v -> drawChildUpdate initialEnv markChildReady $ f k v) dm0 dm'
772 let processChild k (Compose (_, _, sRef, _)) = ComposeMaybe <$> do
774 let processChild k (Compose (_, _, sRef, _)) = ComposeMaybe <$> do
773 readIORef sRef >>= \case
775 readIORef sRef >>= \case
@@ -787,7 +789,6 @@ hoistTraverseWithKeyWithAdjust base mapPatch updateChildUnreadiness applyDomUpda
787 liftIO $ writeIORef placeholders $! placeholders0
789 liftIO $ writeIORef placeholders $! placeholders0
788 _ <- DMap.traverseWithKey (\_ (Compose (df, _, _, _)) -> Constant () <$ append df) children0
790 _ <- DMap.traverseWithKey (\_ (Compose (df, _, _, _)) -> Constant () <$ append df) children0
789 liftIO . writeIORef lastPlaceholderRef =<< textNodeInternal ("" :: Text)
791 liftIO . writeIORef lastPlaceholderRef =<< textNodeInternal ("" :: Text)
790− -- Note: the numbering here must match the numbering of dm''
791 requestDomAction_ $ ffor children' $ \p -> do
792 requestDomAction_ $ ffor children' $ \p -> do
792 (oldUnready, oldP) <- liftIO $ readIORef pendingChange
793 (oldUnready, oldP) <- liftIO $ readIORef pendingChange
793 newUnready <- liftIO $ updateChildUnreadiness p oldUnready
794 newUnready <- liftIO $ updateChildUnreadiness p oldUnready
@@ -795,8 +796,6 @@ hoistTraverseWithKeyWithAdjust base mapPatch updateChildUnreadiness applyDomUpda
795 liftIO $ writeIORef pendingChange (newUnready, newP)
796 liftIO $ writeIORef pendingChange (newUnready, newP)
796 when (DMap.null newUnready) $ do
797 when (DMap.null newUnready) $ do
797 applyDomUpdate newP
798 applyDomUpdate newP
799− liftIO $ writeIORef pendingChange $! mempty
800 return (result0, result')
799 return (result0, result')
802drawChildUpdate :: (MonadIO m, MonadJSM m)
801drawChildUpdate :: (MonadIO m, MonadJSM m)