Loro Container Resurrection Errors and a backdrop-filter Trap That Locked the Structure Popover
Shipping Mindloft v0.3.0: fixing a Loro patchMap error when recreating boundaries or summaries after deleting them all, and moving header backdrop-filter onto ::before after it turned the 40px desktop titlebar into a containing block for position: fixed overlays.
Shipping Mindloft (formerly Brainlet / 枝间) v0.3.0 (e6187977) started with me testing “Add Boundary” and “Add Summary” in the macOS app and noticing both felt half-wired. By the time macOS Universal and Android (versionCode 1000300) went out, the work had uncovered a Loro CRDT container-reattachment bug and a one-line CSS backdrop-filter trap that locked the layout popover onto the canvas.
Recreating boundaries or summaries after deleting them all
First, we wired up the missing workflow: resolveNodeContextMenuSelection in apps/web/src/product/context-menu-model.ts so right-clicking an unselected node recomputes selection, group.addBoundary / group.addSummary in desktop-menu-model.ts, four removal paths (floating toolbar, stroke context menu, Backspace/Delete, and inspector), bilateral isolation on mindmap layouts, and outward staggering for stacked summaries (packages/layout/src/groups.ts and structures.ts).
Then came the crash: delete every boundary and summary on a sheet—and immediately create a new one—and the app threw 命令未提交,请重试。.
Tracing the stack into patchMap inside packages/document-core/src/loro/loro-values.ts revealed why. Deleting the last group removes sheet.extensions entirely. Creating a new boundary in the same session re-attaches a LoroMap or LoroMovableList subcontainer via map.ensureMergeableMap(key) or map.ensureMergeableMovableList(key). Because previous had no active container (!(current instanceof LoroMap)), patchMap failed to seed its baseline from the re-attached container’s snapshot:
if (Array.isArray(value)) {
if (!(current instanceof LoroMovableList) && current !== undefined) map.delete(key);
const list = map.ensureMergeableMovableList(key);
const listPrevious =
current instanceof LoroMovableList && Array.isArray(old)
? old
: (list.toJSON() as JsonValue[]);
patchList(list, listPrevious, value);
} else if (value !== null && typeof value === 'object') {
if (!(current instanceof LoroMap) && current !== undefined) map.delete(key);
const child = map.ensureMergeableMap(key);
const childPrevious =
current instanceof LoroMap && old !== null && typeof old === 'object' && !Array.isArray(old)
? old
: readMap(child);
patchMap(child, childPrevious, value);
}
Seeding listPrevious from list.toJSON() and childPrevious from readMap(child) fixed the transaction mismatch. We locked it down with allows recreating boundaries and summaries after deleting all groups in packages/document-core/test/loro-document-kernel.test.ts and a matching check in apps/mobile/native-lab/engine/test-engine.mjs.
Screenshot checks also caught two focus leaks—clicking a boundary left data-focused dashed outlines on underlying nodes, and pressing Enter in GroupTitleInput leaked focus into HiddenInput—both fixed in mindmap-panel.tsx and workspace-page.tsx.
One backdrop-filter turned a 40px header into a fixed trap
Right before packaging, testing the desktop toolbar hit a blocker: open “Structure”, pick a layout, and clicking empty canvas would not close the popover.
Reading apps/web/src/workspace-shell.css, apps/web/src/product/structure-picker.tsx, and workspace-page.tsx exposed three stacked causes:
backdrop-filtercreated a containing block forposition: fixed: Underhtml[data-desktop-chrome='macos']andwindows,.ramilo-workspace-headeris only40pxtall (--desktop-titlebar-height) and carriedbackdrop-filter: saturate(180%) blur(18px)directly on<header>. By CSS spec,backdrop-filterestablishes a containing block for allposition: fixeddescendants. That squashed.ramilo-menu-dismiss(fixed inset-0 z-20) into a40pxstrip at the top—clicks aty > 40pxnever touched it—and trappedposition: fixed/position-areapopovers inside the same strip.overflow-x: autoclipped vertical popovers:.ramilo-island-toolsusedoverflow-x: auto, which forcesoverflow-y: autoand clipped.ramilo-theme-pickerand non-Anchor fallbacks.- No capture-phase outside click or view reset:
StructurePopoverTriggerlistened only forEscape, had no explicit close button, and stayed open across view (mindmap/outline) or sheet switches.
We moved the blur onto .ramilo-workspace-header::before (z-index: -1; pointer-events: none) in workspace-shell.css:
html[data-desktop-chrome='macos'] .ramilo-workspace .ramilo-workspace-header::before,
html[data-desktop-chrome='windows'] .ramilo-workspace .ramilo-workspace-header::before {
content: '';
position: absolute;
inset: 0;
z-index: -1;
backdrop-filter: saturate(180%) blur(18px);
-webkit-backdrop-filter: saturate(180%) blur(18px);
pointer-events: none;
}
We also set overflow: visible via .ramilo-island-tools:has(.ramilo-menu-dismiss, [aria-expanded='true']), exported shouldDismissPopoverOnPointerDown in structure-picker.tsx with a capture-phase document.addEventListener('pointerdown', ...) listener and [data-testid="sheet-layout-close"], and reset popover state on view or sheet.id change in workspace-page.tsx.
The same v0.3.0 batch shipped DesktopTooltip (420ms initial / 300ms warm-up), stripped Chrome’s default base-select ::picker-icon triangle, added Win11 DWM corners + macOS FollowsWindowActiveState in window_appearance.rs, and ran build:engine to sync motionMs.press: 80 into apps/mobile/native-lab (green across 30 Jest suites / 201 tests and 23 engine checks). In headless browser verification under ?desktopChrome=macos (light and dark), the Structure popover opened cleanly at y = 52, Style expanded to 576px, and all four dismiss paths—canvas click at (120, 420), trigger toggle, close button, and Escape—closed immediately with zero console errors.
Comments