<h4>Groups Newsfeed — Realtime Update Fix</h4><ul><li><strong>ROOT CAUSE:</strong> Comments, likes, and replies were saved to the DB but the UI didn't update because: (1) The newsfeed controller's <code>insertCommentToNewsfeedPost</code> returned a PHP warning (<code>Undefined variable $return_array</code>) when commenting on your own post, corrupting the JSON response. <code>safeParseJSON</code> returned <code>{}</code>, so <code>data.status == 'success'</code> was false, and the prepend/UI code never ran. (2) Even after fixing the PHP warning, <code>sendNotification()</code> was called BEFORE the visual update — if it threw an error (socket disconnected, etc.), all code after it was skipped.</li><li><strong>Fixed:</strong> Reordered ALL 8 AJAX success handlers in newsfeed_js.php — visual update (prepend comment, toggle like button, etc.) now happens FIRST, notification and socket emit happen AFTER, wrapped in try/catch.</li><li><strong>Fixed handlers:</strong> insertComment, likePost, likeComment, likeReply, replyToComment, replyToReply, createPost (restricted), createPost (unrestricted), updatePost.</li><li><strong>Fixed:</strong> Changed <code>setInterval</code> to <code>setTimeout</code> for blink animation removal (was creating infinite timer leaks).</li></ul><p><strong>File:</strong> platform/module/GroupsManager/newsfeed_js.php</p><p><strong>Result:</strong> Comments, likes, and replies now display instantly on submission without page reload.</p>