diff --git a/public/s/js/comments.js b/public/s/js/comments.js index e8f34d5..bdfd719 100644 --- a/public/s/js/comments.js +++ b/public/s/js/comments.js @@ -53,9 +53,8 @@ class CommentSystem { // If comments are already rendered, we might need to re-render them to show emojis // but usually loadComments also happens async. // To be safe, if we just got emojis, trigger a silent update if container exists - if (this.container && this.container.querySelector('.comment-content')) { - // This is a bit heavy, but ensures emojis appear if they loaded AFTER comments - // For now let's just let it be. + if (this.container && this.lastData) { + this.render(this.lastData, this.lastUserId, this.lastIsSubscribed); } } else { this.customEmojis = {}; @@ -188,6 +187,11 @@ class CommentSystem { } render(comments, currentUserId, isSubscribed) { + // Store for re-rendering when emojis load + this.lastData = comments; + this.lastUserId = currentUserId; + this.lastIsSubscribed = isSubscribed; + // Build two-level tree: top-level comments + all replies at one level const map = new Map(); const roots = [];