clay-server 2.29.2 → 2.29.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.
|
@@ -1135,8 +1135,13 @@ export function processMessage(msg) {
|
|
|
1135
1135
|
var _s1 = store.getState();
|
|
1136
1136
|
if (fromId && fromId !== _s1.myUserId) {
|
|
1137
1137
|
_s1.dmUnread[fromId] = (_s1.dmUnread[fromId] || 0) + 1;
|
|
1138
|
-
//
|
|
1139
|
-
|
|
1138
|
+
// Only re-render the full strip if the sender isn't already visible
|
|
1139
|
+
// (e.g. non-favorited user sending their first message). Otherwise
|
|
1140
|
+
// just update the badge in-place to avoid a full DOM rebuild flicker.
|
|
1141
|
+
var existingEl = document.querySelector('.icon-strip-user[data-user-id="' + fromId + '"]');
|
|
1142
|
+
if (!existingEl) {
|
|
1143
|
+
renderUserStrip(_s1.cachedAllUsers, _s1.cachedOnlineIds, _s1.myUserId, _s1.cachedDmFavorites, _s1.cachedDmConversations, _s1.dmUnread, _s1.dmRemovedUsers, _s1.cachedMatesList);
|
|
1144
|
+
}
|
|
1140
1145
|
updateDmBadge(fromId, _s1.dmUnread[fromId]);
|
|
1141
1146
|
}
|
|
1142
1147
|
}
|
|
@@ -1170,12 +1170,57 @@ function showWorktreeModal(parentSlug, parentName) {
|
|
|
1170
1170
|
|
|
1171
1171
|
// --- Render icon strip ---
|
|
1172
1172
|
|
|
1173
|
+
// Build a fingerprint string for the project list so we can detect when only
|
|
1174
|
+
// the active slug changed (no structural DOM rebuild needed).
|
|
1175
|
+
function projectListFingerprint(projects) {
|
|
1176
|
+
var parts = [];
|
|
1177
|
+
for (var i = 0; i < projects.length; i++) {
|
|
1178
|
+
var p = projects[i];
|
|
1179
|
+
parts.push(p.slug + ":" + (p.icon || "") + ":" + (p.isProcessing ? 1 : 0) + ":" + (p.unread || 0) + ":" + (p.pendingPermissions || 0) + ":" + (p.isWorktree ? 1 : 0) + ":" + (p.parentSlug || "") + ":" + (p.worktreeAccessible !== false ? 1 : 0));
|
|
1180
|
+
}
|
|
1181
|
+
return parts.join("|");
|
|
1182
|
+
}
|
|
1183
|
+
var _lastStripFingerprint = "";
|
|
1184
|
+
|
|
1173
1185
|
export function renderIconStrip(projects, currentSlug) {
|
|
1174
1186
|
cachedProjectList = projects;
|
|
1175
1187
|
cachedCurrentSlug = currentSlug;
|
|
1176
1188
|
|
|
1177
1189
|
var container = document.getElementById("icon-strip-projects");
|
|
1178
1190
|
if (!container) return;
|
|
1191
|
+
|
|
1192
|
+
// Fast path: if only the active slug changed (project list unchanged),
|
|
1193
|
+
// just toggle active classes instead of a full DOM rebuild.
|
|
1194
|
+
var fp = projectListFingerprint(projects);
|
|
1195
|
+
if (fp === _lastStripFingerprint && container.children.length > 0) {
|
|
1196
|
+
var currentDmUserId2 = _ctx.getCurrentDmUserId ? _ctx.getCurrentDmUserId() : null;
|
|
1197
|
+
var items = container.querySelectorAll(".icon-strip-item");
|
|
1198
|
+
for (var fi = 0; fi < items.length; fi++) {
|
|
1199
|
+
var isNowActive = items[fi].dataset.slug === currentSlug && !currentDmUserId2;
|
|
1200
|
+
items[fi].classList.toggle("active", isNowActive);
|
|
1201
|
+
// Update unread badge visibility (active items hide their badge)
|
|
1202
|
+
var badge = items[fi].querySelector(".icon-strip-project-badge");
|
|
1203
|
+
if (badge && badge.classList.contains("has-unread") && isNowActive) {
|
|
1204
|
+
badge.textContent = "";
|
|
1205
|
+
badge.classList.remove("has-unread");
|
|
1206
|
+
}
|
|
1207
|
+
// Update pending permission glow
|
|
1208
|
+
if (isNowActive) items[fi].classList.remove("has-pending-perm");
|
|
1209
|
+
}
|
|
1210
|
+
// Update home icon
|
|
1211
|
+
var homeIcon2 = document.querySelector(".icon-strip-home");
|
|
1212
|
+
if (homeIcon2) {
|
|
1213
|
+
if ((!currentSlug || projects.length === 0) && !currentDmUserId2) {
|
|
1214
|
+
homeIcon2.classList.add("active");
|
|
1215
|
+
} else {
|
|
1216
|
+
homeIcon2.classList.remove("active");
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
renderProjectList(projects, currentSlug);
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
_lastStripFingerprint = fp;
|
|
1223
|
+
|
|
1179
1224
|
container.innerHTML = "";
|
|
1180
1225
|
|
|
1181
1226
|
var currentDmUserId = _ctx.getCurrentDmUserId ? _ctx.getCurrentDmUserId() : null;
|