clay-server 2.29.5-beta.1 → 2.29.5-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -229,23 +229,12 @@ export function updateProjectList(msg) {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
// Update user strip (DM targets) -
|
|
232
|
+
// Update user strip (DM targets) - renderUserStrip has its own fingerprint guard
|
|
233
233
|
if (msg.allUsers) {
|
|
234
|
-
var allUsersJson = JSON.stringify(msg.allUsers);
|
|
235
|
-
var dmFavJson = msg.dmFavorites ? JSON.stringify(msg.dmFavorites) : _lastDmFavJson;
|
|
236
|
-
var dmConvJson = msg.dmConversations ? JSON.stringify(msg.dmConversations) : _lastDmConvJson;
|
|
237
|
-
var userDataChanged = allUsersJson !== _lastAllUsersJson || dmFavJson !== _lastDmFavJson || dmConvJson !== _lastDmConvJson;
|
|
238
|
-
|
|
239
234
|
_ctx.setCachedAllUsers(msg.allUsers);
|
|
240
235
|
if (msg.dmFavorites) _ctx.setCachedDmFavorites(msg.dmFavorites);
|
|
241
236
|
if (msg.dmConversations) _ctx.setCachedDmConversations(msg.dmConversations);
|
|
242
|
-
|
|
243
|
-
if (userDataChanged) {
|
|
244
|
-
_lastAllUsersJson = allUsersJson;
|
|
245
|
-
_lastDmFavJson = dmFavJson;
|
|
246
|
-
_lastDmConvJson = dmConvJson;
|
|
247
|
-
_ctx.renderUserStrip(msg.allUsers, _ctx.cachedOnlineIds, _ctx.myUserId, _ctx.cachedDmFavorites, _ctx.cachedDmConversations, _ctx.dmUnread, _ctx.dmRemovedUsers, _ctx.cachedMatesList);
|
|
248
|
-
}
|
|
237
|
+
_ctx.renderUserStrip(msg.allUsers, _ctx.cachedOnlineIds, _ctx.myUserId, _ctx.cachedDmFavorites, _ctx.cachedDmConversations, _ctx.dmUnread, _ctx.dmRemovedUsers, _ctx.cachedMatesList);
|
|
249
238
|
if (document.body.classList.contains("mate-dm-active") || document.body.classList.contains("wide-view")) {
|
|
250
239
|
var refreshedMyUser = _ctx.cachedAllUsers.find(function (u) { return u.id === _ctx.myUserId; });
|
|
251
240
|
if (refreshedMyUser) {
|
|
@@ -271,9 +260,6 @@ export function updateProjectList(msg) {
|
|
|
271
260
|
var _lastTopbarUserIds = [];
|
|
272
261
|
var _lastProjectsJson = "";
|
|
273
262
|
var _lastRenderedSlug = null;
|
|
274
|
-
var _lastAllUsersJson = "";
|
|
275
|
-
var _lastDmFavJson = "";
|
|
276
|
-
var _lastDmConvJson = "";
|
|
277
263
|
export function renderTopbarPresence(serverUsers) {
|
|
278
264
|
var countEl = document.getElementById("client-count");
|
|
279
265
|
if (!countEl) return;
|
|
@@ -19,6 +19,7 @@ var currentDmUserId = null;
|
|
|
19
19
|
var dmPickerOpen = false;
|
|
20
20
|
var cachedDmRemovedUsers = {};
|
|
21
21
|
var cachedMates = [];
|
|
22
|
+
var _lastUserStripJson = "";
|
|
22
23
|
|
|
23
24
|
// --- Icon strip tooltip ---
|
|
24
25
|
var iconStripTooltip = null;
|
|
@@ -238,6 +239,11 @@ function presenceAvatarUrl(userOrStyle) {
|
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
export function renderUserStrip(allUsers, onlineUserIds, myUserId, dmFavorites, dmConversations, dmUnread, dmRemovedUsers, matesList) {
|
|
242
|
+
// Skip full DOM rebuild if input data hasn't changed
|
|
243
|
+
var fingerprint = JSON.stringify([allUsers, onlineUserIds, dmFavorites, dmConversations, dmUnread, dmRemovedUsers, matesList]);
|
|
244
|
+
if (fingerprint === _lastUserStripJson) return;
|
|
245
|
+
_lastUserStripJson = fingerprint;
|
|
246
|
+
|
|
241
247
|
cachedMates = matesList || cachedMates || [];
|
|
242
248
|
cachedAllUsers = allUsers || [];
|
|
243
249
|
cachedOnlineUserIds = onlineUserIds || [];
|
|
@@ -330,9 +336,11 @@ export function renderUserStrip(allUsers, onlineUserIds, myUserId, dmFavorites,
|
|
|
330
336
|
}
|
|
331
337
|
}
|
|
332
338
|
|
|
333
|
-
// Render mates (
|
|
339
|
+
// Render mates (favorites + unread in multi-user, all in single-user)
|
|
340
|
+
var singleUser = allOthers.length === 0;
|
|
334
341
|
var favoriteMates = cachedMates.filter(function (m) {
|
|
335
342
|
if (cachedDmRemovedUsers[m.id]) return false;
|
|
343
|
+
if (singleUser) return true;
|
|
336
344
|
if (cachedDmFavorites.indexOf(m.id) !== -1) return true;
|
|
337
345
|
if (cachedDmUnread[m.id] && cachedDmUnread[m.id] > 0) return true;
|
|
338
346
|
return false;
|