components
All repositories: gitoria
3.9 KB
# F3 — MdEditor ignores a value that changes from outside (data loss)Branch f3-mdvalue (components c2d0de5 + d58ed98). Not merged, pushed or deployed.## CauseMdEditor builds its contenteditable surface once (mdMount, from the hidden field) and the framework never repaints it. hl:web hands kept offline state (rehydrate) and pushes from other devices to the host as ordinary writes of the bound member `value` (Arachne: no way to apply kept state before the children mount). Only the hidden `<input value>` followed; the surface kept the old text, so the next key wrote OLD text + key back (saved `20` + `5` became `25`, not `205`). Seen at CPU throttle 6 where rehydrate lands after the 100 ms mount.## Fix (components/md-editor/md-editor.hl, pure Hybriel, no polling or re-keying)- The root carries `'data-value' = value`; at mount a `MutationObserver` on that attribute calls `followValue` (new, with `own`).- `mdSeen` = every value the editor loaded or wrote itself since the last outside change (capped at 300000 chars; the first entry stays). A value not in it is OUTSIDE: `load()` into the surface, the source textarea and the field follow, caret to the end if focused.- A value that is in it is an older text of the editor itself handed back (the host answers with the server's version while the user has typed on; the row of a new note first shows its empty text). It is not news: the surface is kept and `sync()` writes it back. My first version loaded such values and lost typed keys (notes gate, throttle 6: "tables: typed to the end" timeouts; MDOUT log showed `v=""` with 150 own values); this is the "unless the user has typed since" rule.- Demo buttons `#md-outside`, `#md-stale` + 12 new gate checks `f3:` (outside value shown, field/source follow, first keys continue from it, 36 fast keys kept, second outside change, source view open, older text handed back keeps typed text).- notes, tickets, layouts: verbatim copy of md-editor.hl, branch f3-mdvalue in each worktree (notes 0516b4c, tickets 138d198, layouts badc187; notes also tests/e2e-outside.mjs).## Proof1. Components gate (COMPONENTS_GATE_PORT 8740): new 492/0 (runs: 491/1 flaky comments push check once under load 36, then 492/0 ×2); main code with the new tests: the f3 checks FAIL (surface `<p><br></p>`, 202 passed / 3 failed, then crash). Main with its own tests: 480.2. F2 repro (notes copy, .scratch/f2-mdvalue/run.mjs, waits for hydration): old `{"field":"after","shown":"before"} BUG`; new `{"field":"after","shown":"after"} OK`.3. Notes browser gate: HL_CPU_THROTTLE=6 old: 68/1, 57/1 (crash, load), 68/1 — "tables: offline" fails 2 of 3. New (final code) 5× 69/0. Normal speed new 3× 69/0. (An earlier version of the fix failed 3 of 3 throttled runs at table typing; fixed by `mdSeen`.)4. Deploy gates new == main, 0 failed: components 492/0 (480 + 12 new); notes 69/0 + theme 21 files 0 problems; tickets browser 386/0, events 52/0, theme 45/0; layouts browser 310/0, theme 43/0 (same on main).5. Real browser E2E on lisbeth (tests/e2e-outside.mjs in the notes branch, copy of the newest backup, lock rules kept, tunnel -L 8745 -R 8744, tab put back to about:blank): a note with a table open, another device saves qty 20 + a line (API, same login, live push), click the cell, End, type 5. Old: surface keeps `2`, field `25`, server `25` and the other device's line lost (390 px). New: 13/13 at 390 and 1280 px, surface shows 20 + new line, field and server `205` + the line.Screenshots (/media/STORAGE/claude-scratch/atlas/F3/shots/): old-390-1-open, old-390-2-after-push (stale `2`), old-390-3-typed (`25`), old-1280-*; new-390-2-after-push, new-390-3-typed (`205`), new-1280-3-typed (`205`, "Changed on another device").## LimitsA genuine outside value identical to a text the editor held earlier since the last outside change (e.g. another device reverts to it) is not loaded: the editor's text wins and is written back. Arachne's 400 ms-slow-kept-read case is covered by the `#md-outside` check (a later write to the bound member).
Branches
Latest commits
- 626de199MdEditor: copy and cut put the selection's Markdown on the clipboard, a clipboard with HTML only pastes its text, gate checks for copy, cut and paste (components#20)mre
- 5228126dUX: components synced from the tickets/layouts UX mission (comments: State select in the footer and button words; files-upload: one-box pick mode; modal: footer rule for its own footer). WIP: the gate's #18 pick-mode checks still expect the old drop zone (11 fail), see the UX2 reportmre
- 0a9216fbMdEditor: a Table button in the toolbar, a typed pipe row fills the cells, tables take the page theme's look; gate checks updated for 12 toolbar buttonsmre
- f9d405c8comments: reactions row half as far from its comment (creator 2026-10-24: 'half this distance please'); the 44 px tap targets staymre
- 4922f9cfsessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- 0355975areports/MC-mobile.md, LOG, STATUS (MC)mre
- 3f0a7229Month view, date picker, range picker: names follow the page language (English by default, not the browser's), weekday/month names formatted in UTC (a UTC+12 zone showed Tue first), 44 px day cells and buttons, Send row air; gate checks at 390 px for every page, popup and dialog (MC)mre
- 29eb07eaPhone: 44 px targets on the site (brand, home links, buttons), comments, modal and pagination; the header is the brand alone on a phone; comments demo: labelled 'You are' group with the chosen user pressed (MC)mre
- d1cc83e2reports/E2-toolbar.mdmre
- 214c3183MdEditor on a phone: toolbar as two even rows of 44 px targets (no clipped icon, no swipe), 'Markdown source' label 15 px, table head 16 px; gate checks (E2)mre
- 9215bbaareports/F5-empty.mdmre
- 134b4e3eMdEditor: an editor the framework puts into the page is built at once (page observer), a surface put in anew under a built editor is redrawn; gates for both (hybriel#211)mre
- 0dce2899reports/K1-bubble.mdmre
- 6b0936a0comments: 'edited' foldable also drops the theme's border, margin and radius (display: contents alone left them computed)mre
- 8d79ff79comments bubble hugs its content: a readonly md-editor surface gets no inline min-height (it beat the stylesheet's min-height 0); 'edited' is a quiet label beside the time, versions unframed; gate checksmre
- ef253fecreports/F4-icons.mdmre
- ba96735ficons: README, md-editor README note, gate checks for the single focus ring and toolbar iconsmre
- 96c97691icons: shared Icon component; md-editor toolbar and files-upload remove use it; no inner focus ring in md-editormre
- 0d6863d6reports/F3-mdvalue.mdmre
- d58ed98bMdEditor: an older text of the editor handed back is not an outside change (kept surface, written back); gate for itmre