Skip to content

feat(studio): optimistic in-memory edits (near-instant canvas) + inspector round 4#77

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/studio-optimistic-edits
Jul 19, 2026
Merged

feat(studio): optimistic in-memory edits (near-instant canvas) + inspector round 4#77
LeadcodeDev merged 1 commit into
mainfrom
feat/studio-optimistic-edits

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #76.

Near-instant editing (user: "quasi-instantanéité"): every edit applies to the in-memory model immediately — raw mutation via the pure setters, scenario rebuild through the exact loader pipeline (measured 492µs release on a 44KB/360-element doc → no coalescing needed), fresh Arcs (prefetch #68 follows), generation bump, and a direct rev-signal nudge. Perceived latency: ~15-25ms (one render) instead of ~300-550ms. The 250ms debounced disk write is byte-for-byte unchanged (undo history, Saving flag, write_error). Transiently-invalid mid-typing edits leave the model untouched, silently.

Self-write skip (correctness, not just optimization): a ledger of written-content hashes lets the watcher skip reloading our own writes — the disk reload could otherwise overwrite a newer in-memory state under continuous typing. External edits (agents, editors) still reload. Undo/redo note their writes AND adopt the restored state in memory; a failed adoption clears the note so the watcher takes over. Annotation writes keep the watcher path.

Color picker fixes (live-testing feedback, diagnosed via the written file): the popover's square/hue drags now preview live and propagate per change — the selection loop is closed through a local HSV mirror, covering every usage (curated rows, ColorList, Fill) at once. The popover opens leftward (the inspector hugs the right edge) and flips upward when it would clip the window bottom.

Content first for text-family components.

Skipped with rationale: the optional "Not visible at this frame" hint — the inspector panel is deliberately memoized against frame changes (wave-1 design: controls keep focus during playback); doing it right needs an isolated sub-component subscribed to current alone. Proposed for a later round.

Tests: 6 new (self-write decisions, optimistic rebuild + invalid-mutation safety, HTML retranspile, undo adoption flow, content-first ordering). 397 total, all green.

Verify: cargo check -p rustmotion-studio ✓ · cargo test --workspace → 397 passed ✓ · cargo fmt --check ✓ · clippy gated ≤1 ✓

…-first

- every edit applies to the in-memory model immediately (raw mutation
  via the pure setters, scenario rebuild through the loader pipeline —
  measured 492us release on a 44KB doc, no coalescing needed — fresh
  Arcs, generation bump) and nudges the rev signal directly: canvas
  updates in ~one render instead of ~300-550ms; the 250ms debounced
  disk write is unchanged (history/undo/write_error/saving intact);
  transiently-invalid edits leave the model untouched silently
- self-write ledger: the watcher skips reloads whose content hash
  matches our last write (a correction: the disk reload could
  overwrite a newer in-memory state under continuous typing);
  external edits still reload; undo/redo note their write AND adopt
  the restored state in memory (failed adoption clears the note so
  the watcher takes over); annotation writes keep the watcher path
- color picker: internal HSV mirror closes the selection loop locally
  — square/hue drags preview live and forward on_color_change per
  change (all usages covered: curated rows, ColorList, Fill); popover
  opens leftward (right-edge panel) and flips up when it would clip
  the window bottom
- CONTENT section renders above PROPERTIES for text-family components
- HTML sources gain an in-memory html_source for the optimistic
  retranspile; known pre-existing limit documented (two different
  fields in one debounce window: disk converges on next edit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(studio): optimistic in-memory edits (near-instant canvas) + content-first inspector

1 participant