Scope mode and gesture subscriptions and isolate controller leases
This commit is contained in:
+22
-3
@@ -269,11 +269,14 @@ Import from `/react` for React only, or the re-export in `/react-flow`.
|
||||
- `useActions(target)` exposes stable `rename`, `setData`, `resize`, `remove`, and
|
||||
`moveTo` facades over normal editor commands. Optional command settings retain
|
||||
label/grouping/history semantics. Call actions from events, not during render.
|
||||
- `useMode(target)` returns the current view's mode and `setMode`; it never writes
|
||||
document/history state. Missing view context is an explicit error.
|
||||
- `useMode(target)` returns the current view's mode and `setMode`; its session
|
||||
subscription is keyed by view and target. It never writes document/history
|
||||
state. Missing view context is an explicit error.
|
||||
- `useGestureBindings(target)` returns effective geometry, active ownership and
|
||||
`begin/update/commit/cancel`. A token protects the lease; cleanup cancels only
|
||||
its own lease. Host input bindings still handle pointer capture and events.
|
||||
its own lease. Controller replacements keep independent token slots. Preview
|
||||
geometry remains shared across views; active ownership and controls belong to
|
||||
the owning view. Host bindings still handle pointer capture and events.
|
||||
- `useOperation(id)` observes both the logical record and its frozen request.
|
||||
- `useAsset(id)` resolves a releasable display handle, returns metadata plus
|
||||
loading/ready/error/url/retry, and releases on ref/owner change or unmount.
|
||||
@@ -523,3 +526,19 @@ const title = useElement(target, view =>
|
||||
A change to another field on this target evaluates the title selector but does
|
||||
not rerender its consumer. Unrelated target edits skip the selector entirely.
|
||||
This is ID routing and value selection, not a static field dependency index.
|
||||
|
||||
|
||||
Mode and gesture hooks pair keyed element lookups with small session selections,
|
||||
instead of retaining a full Root/session pair per hook. All session channels in
|
||||
an engine share one upstream listener. Mode buckets use view→target Maps;
|
||||
gesture buckets use target IDs. Preview updates compare the active preview map,
|
||||
then notify only changed targets. A WeakMap indexes each immutable target array
|
||||
once for incarnation checks. Viewport/selection-only updates and connection
|
||||
previews do not reevaluate these node hook selectors.
|
||||
|
||||
The pairing caches lookup/selection tuples; values stay fresh on direct reads,
|
||||
and equal effective geometry/mode values suppress intermediate renders. The last
|
||||
subscription removes its bucket and releases the upstream listener. A controller
|
||||
identity change (engine/view/target/incarnation) creates a private lease slot, so
|
||||
old cleanup cannot consume the replacement controller's token. This does not
|
||||
change the one shared gesture owner, its history unit or durable task lifecycle.
|
||||
|
||||
Reference in New Issue
Block a user