Fix wave chunk 1: cross-surface settings signal, dialog scroll-lock, noneRow retired

- lh:settings-saved CustomEvent (the lh:chat-renamed pattern, owner
  ruling): every writer (composer save, SetupDialog save, the settings
  write seam — one dispatch point carrying the section) notifies after a
  successful PUT; every reader re-reads its own seam: ModelControl's
  record read, the Agent section's slots/catalog, and chat.tsx's
  configured state (clearing slots mid-session now surfaces the setup
  CTA without a reload). Self-notifications re-read idempotently.
- MenuShell now announces lh:menu-open/lh:menu-close (still placement-
  only); the settings dialog's content column locks (overflow-hidden,
  count-based) while any menu is open — wheel-scrolling with a dropdown
  down is dead; the re-place-on-scroll fallback stays for un-lockable
  surfaces.
- The settings thinking menus' 'Default' noneRow is retired (owner:
  the unset state can't re-enter once chunk 2's auto-populate lands; no
  unpin is needed).
- Live-caught regression from the MenuShell migration fixed: the
  composer's outside-click handler never learned the portaled menu body
  isn't a container descendant — menu-row pointerdowns counted as
  outside and ATE THE PICK (composer picks have been dead for pointer
  users since 221c99d); rows now carve out via [data-lh-menu], the
  settings sections' discipline.
- Item 4 (resolved-level display for legacy records) deferred to chunk 2
  per owner ruling — the payload omits the level for legacy no-level
  records and DEFAULT_THINKING_ORDER was server-only (now in the core
  barrel via bd68486, exactly the seam chunk 2 needs).
This commit is contained in:
amosblomqvist
2026-09-22 21:55:33 +03:00
parent 9387418864
commit e766a13eb1
8 changed files with 207 additions and 44 deletions
+19 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from "react";
import { useEffect, useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from "react";
import { createPortal } from "react-dom";
/**
@@ -43,6 +43,16 @@ const CAP_VH = 0.6; // 60vh — the graph pattern's cap
const MIN_USABLE = 96; // floor: a shorter cap is an unusable sliver; the
// cap then overflows the edge instead of crushing the menu
/** A MenuShell mounted = a dropdown open (fix wave, owner ruling:
* the settings dialog's content column locks while any menu is down —
* no scrolling under a dropdown). The shell stays placement-only: it
* just ANNOUNCES, surfaces decide what to do with the fact (the
* settings dialog locks; anything un-lockable keeps the re-place-on-
* scroll fallback below). Count-based: overlapping menus open/close in
* any order and the accounting stays balanced. */
export const MENU_OPEN_EVENT = "lh:menu-open";
export const MENU_CLOSE_EVENT = "lh:menu-close";
export type MenuSide = "up" | "down";
export type MenuAlign = "left" | "right";
@@ -116,6 +126,14 @@ export function MenuShell({
const menuRef = useRef<HTMLDivElement>(null);
const [placed, setPlaced] = useState<MenuPlacement | null>(null);
// Announce open↔close for lockable surfaces (see MENU_OPEN_EVENT).
useEffect(() => {
window.dispatchEvent(new CustomEvent(MENU_OPEN_EVENT));
return () => {
window.dispatchEvent(new CustomEvent(MENU_CLOSE_EVENT));
};
}, []);
const anchor = () => {
if (anchorRef) return anchorRef.current;
if (anchorTestid !== undefined) return document.querySelector(`[data-testid="${anchorTestid}"]`);