From a9198b1cf638912990295b65212bb519a0a3fb51 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Tue, 6 Feb 2018 10:57:16 +0200 Subject: [PATCH] Fix duplicate chat containers and unread markers when reconnecting Fixes #1721 --- client/js/render.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/client/js/render.js b/client/js/render.js index c85e380e..1530c52a 100644 --- a/client/js/render.js +++ b/client/js/render.js @@ -228,19 +228,21 @@ function renderNetworks(data, singleNetwork) { newChannels = channels; } - chat.append( - templates.chat({ - channels: channels, - }) - ); + if (newChannels.length > 0) { + chat.append( + templates.chat({ + channels: newChannels, + }) + ); - newChannels.forEach((channel) => { - renderChannel(channel); + newChannels.forEach((channel) => { + renderChannel(channel); - if (channel.type === "channel") { - chat.find("#chan-" + channel.id).data("needsNamesRefresh", true); - } - }); + if (channel.type === "channel") { + chat.find("#chan-" + channel.id).data("needsNamesRefresh", true); + } + }); + } utils.confirmExit(); sorting();