Today I Learned

Daily reflections on work and learning—what I did and what I learned.

20267

2026-07-10

Modal peek stack and a CSS-layer package

A day aligning peek UX and theme customization via document push inside a single dialog and @layer-based editor CSS splitting

  • gallery→peek is more continuous when you just swap documentId in the same shell rather than opening a fresh dialog
  • async resolve must block the (newId, oldContent) intermediate frame with a render-time reset
2026-07-09

Hierarchical document nav and viewer bundle splitting

A day tuning both portfolio-demo depth and bundle size at once, via a page push/peek navigator and a separate read-only viewer entry

  • A document graph is better separated from the flat editor via a page block + push/peek navigator contract
  • peek/embed can share DOM with the editor, but the import graph must differ for the viewer bundle to shrink
2026-07-06

Bundle Shared Vendor, Cross-Block Selection, Floating-UI Coordinates

webpack splitChunks traps, cross-block range operations in a hybrid editor, selectionchange·scroll anchor patterns, Context subscription separation

  • Using chunks:all with a fixed name on a catch-all vendor pulls dynamic imports up into a shared chunk.
  • For cross-block text operations, stateless derivation from getSelection + a single boundary split is safer than range state.
2026-07-05

Block-Editor Ordering, Collaboration, and Keyboard Contracts

General patterns: fractional ordering, optimistic rebase, IME defer, keyboard undo delegation, scoped popover, Jest ESM shim, and more

  • For sibling ordering, a fractional position key + neighbor anchor + tie-break is better for concurrent inserts than an integer index.
  • Optimistic UI can't rebase without an inverse patch, and the remote seq must be the merge authority.
2026-07-04

The Document Is the Host SoT; the Editor Is a Focused Guest

Explaining, for a first-time reader, the host/guest boundary in a block-document editor, React external-store snapshots, the 2-stack undo, and HTML5 drag and selection/copy

  • Document meaning is owned by host patches, and the rich-text engine is kept only as a guest for the focused block.
  • Using only a ms timestamp in a useSyncExternalStore snapshot drops re-renders on same-ms mutations — a monotonic revision is needed.