             }
           </div>
         </div>
-        {if message.children.length
-          renderedChildren =
-            if message.readChildren?
-              for child in message.readChildren
+        {if children.length
+          <>
+            <div className="children clearfix">
+              {for child in children
                 <Submessage key={child._id} message={child} read={read}/>
-            else
-              for childID in message.children
-                <SubmessageID key={childID} messageID={childID} read={read}/>
-          renderedChildren = (rendered for rendered in renderedChildren when rendered?)
-          if renderedChildren.length
-            <>
-              <div className="children clearfix">
-                {renderedChildren}
-              </div>
-              <div className="panel-body panel-secondbody hidden-print clearfix">
-                <ReplyButtons message={message}/>
-                <span className="message-title">
-                  <a className="btn btn-default btn-xs linkToTop" aria-label="Top" href="##{message._id}">
-                    <span className="fas fa-caret-up"/>
-                  </a>
-                  <span className="space"/>
-                  {if historified.file
-                    <span className="fas fa-paperclip"/>
-                  }
-                  <span className="panel-title"
-                  dangerouslySetInnerHTML={__html: formattedTitle[1]}/>
-                  <MessageTags message={message}/>
-                  <MessageLabels message={message}/>
-                </span>
-              </div>
-            </>
+              }
+            </div>
+            <div className="panel-body panel-secondbody hidden-print clearfix">
+              <ReplyButtons message={message}/>
+              <span className="message-title">
+                <a className="btn btn-default btn-xs linkToTop" aria-label="Top" href="##{message._id}">
+                  <span className="fas fa-caret-up"/>
+                </a>
+                <span className="space"/>
+                {if historified.file
+                  <span className="fas fa-paperclip"/>
+                }
+                <span className="panel-title"
+                dangerouslySetInnerHTML={__html: formattedTitle[1]}/>
+                <MessageTags message={message}/>
+                <MessageLabels message={message}/>
+              </span>
+            </div>
+          </>
         }
       </>
     }

  <Submessage message={message} read={read}/>
SubmessageID.displayName = 'SubmessageID'

Submessage = ({message, read}) ->
  <ErrorBoundary>
    <WrappedSubmessage message={message} read={read}/>
  </ErrorBoundary>


submessageCount = 0
WrappedSubmessage = React.memo ({message, read}) ->
  here = useTracker ->
    routeHere message._id
  , [message._id]
