From 14f02fe52d4300c35c4afa0456a3e599cd4632ec Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 01:07:54 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20clean=20up=20hot-path?= =?UTF-8?q?=20debug=20logging=20in=20cursor=20decorations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com> --- pkgs/id/web/src/cursor-utils.ts | 3 +-- pkgs/id/web/src/cursors.ts | 24 ------------------------ 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/pkgs/id/web/src/cursor-utils.ts b/pkgs/id/web/src/cursor-utils.ts index 671288ca3c..1a0a2d1868 100644 --- a/pkgs/id/web/src/cursor-utils.ts +++ b/pkgs/id/web/src/cursor-utils.ts @@ -114,8 +114,7 @@ export const CURSOR_COLORS = [ * Uses a hash function to map client IDs to colors. */ export function getColorForClient(clientID: string | number): string { - // A plain loop: no intermediate array of characters per call. - const str = String(clientID); + const str = typeof clientID === "string" ? clientID : String(clientID); let hash = 0; for (let i = 0; i < str.length; i++) { hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0; diff --git a/pkgs/id/web/src/cursors.ts b/pkgs/id/web/src/cursors.ts index 2cafe3d04d..6405e4ce94 100644 --- a/pkgs/id/web/src/cursors.ts +++ b/pkgs/id/web/src/cursors.ts @@ -603,21 +603,6 @@ function createCursorDecorations( // Cluster overlapping groups - only merge those that actually overlap const clusters = clusterOverlappingGroups(positionGroups, getLeftCoord); - // DEBUG: Log clustering results - if (positionGroups.length > 1) { - console.log("[cursor-debug] positionGroups:", positionGroups.length, "clusters:", clusters.length); - positionGroups.forEach((g, i) => { - const left = getLeftCoord ? getLeftCoord(g.position) : "no-view"; - console.log( - ` group[${i}]: pos=${g.position}, left=${left}, cursors=${g.cursors.map((c) => c.clientID).join(",")}`, - ); - }); - clusters.forEach((c, i) => { - console.log( - ` cluster[${i}]: groups=${c.groups.length}, cursors=${c.groups.flatMap((g) => g.cursors.map((cur) => cur.clientID)).join(",")}`, - ); - }); - } clusters.forEach((cluster) => { // Check if own cursor is in this cluster @@ -811,7 +796,6 @@ export function createCursorPlugin(myClientID: string | number | null, sendCurso if (cursorUpdate) { switch (cursorUpdate.type) { case "update": { - console.log("[cursor-debug] apply() UPDATE for", cursorUpdate.clientID, "at", cursorUpdate.head); const newCursors = new Map(pluginState.cursors); // If idleSecs is provided (initial load), backdate lastUpdate const lastUpdate = cursorUpdate.idleSecs ? Date.now() - cursorUpdate.idleSecs * 1000 : Date.now(); @@ -923,14 +907,6 @@ export function createCursorPlugin(myClientID: string | number | null, sendCurso const pluginState = cursorPluginKey.getState(state); if (!pluginState) return DecorationSet.empty; - // DEBUG: Log cursor count - console.log( - "[cursor-debug] decorations() called, cursor count:", - pluginState.cursors.size, - "cursors:", - Array.from(pluginState.cursors.keys()).join(","), - ); - return createCursorDecorations(state, pluginState, myClientID, currentView); }, }, From 4274855584d657e12a60b91ff45ca6f52aa703dc Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 01:25:16 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20clean=20up=20hot-path?= =?UTF-8?q?=20debug=20logging=20in=20cursor=20decorations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com> --- pkgs/id/web/src/cursors.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/id/web/src/cursors.ts b/pkgs/id/web/src/cursors.ts index 6405e4ce94..0506c7212c 100644 --- a/pkgs/id/web/src/cursors.ts +++ b/pkgs/id/web/src/cursors.ts @@ -603,7 +603,6 @@ function createCursorDecorations( // Cluster overlapping groups - only merge those that actually overlap const clusters = clusterOverlappingGroups(positionGroups, getLeftCoord); - clusters.forEach((cluster) => { // Check if own cursor is in this cluster const clusterHasOwnCursor = cluster.groups.some((g) => g.cursors.some((c) => c.isOwnCursor));