Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(chat): disable focus button on pages without an anchor (#1509)

Naiyuan Qingf6dd47c94475
diff --git a/packages/views/chat/components/context-anchor.tsx b/packages/views/chat/components/context-anchor.tsx
index a2e289903a..27c4f39c93 100644
--- a/packages/views/chat/components/context-anchor.tsx
+++ b/packages/views/chat/components/context-anchor.tsx
@@ -109,13 +109,13 @@ export function useRouteAnchorCandidate(wsId: string): {
}
/**
- * Focus-mode toggle. Three visual states driven by two dimensions:
- * - focusMode (persisted) on | off
- * - candidate present yes | no
+ * Focus-mode toggle. Disabled whenever the current page has no anchor
+ * (nothing to share) — focusMode persists across such pages, so returning
+ * to an anchorable page restores the user's prior on/off choice.
*
- * off → ghost + muted, clickable (→ turns on)
+ * no candidate → disabled
+ * off + candidate → ghost + muted, clickable (→ turns on)
* on + candidate → secondary (bright), clickable (→ turns off)
- * on + no candidate → disabled (can't click until a focus target exists)
*/
export function ContextAnchorButton() {
const wsId = useWorkspaceId();
@@ -124,16 +124,16 @@ export function ContextAnchorButton() {
const setFocusMode = useChatStore((s) => s.setFocusMode);
const hasAnchor = !!candidate;
- const isDisabled = focusMode && !hasAnchor && !isResolving;
+ const isDisabled = !hasAnchor && !isResolving;
const isBright = focusMode && hasAnchor;
- const tooltipText = !focusMode
- ? "Let Multica know what you're viewing"
- : hasAnchor
+ const tooltipText = isDisabled
+ ? "Nothing to share with Multica on this page"
+ : focusMode && candidate
? candidate.type === "issue"
? `Multica knows you're viewing ${candidate.label} · Click to turn off`
: `Multica knows you're viewing project "${candidate.label}" · Click to turn off`
- : "Nothing to share with Multica on this page";
+ : "Let Multica know what you're viewing";
return (
<Tooltip>