Repository navigation
fig@2.0.0
- @bgub/fig@2.0.0
- @bgub/fig-dom@2.0.0
- @bgub/fig-reconciler@2.0.0
- @bgub/fig-server@2.0.0
Catch data changes before subscription commit (4b29396)
Recheck rendered data values after installing subscriptions so updates from deletion cleanup or reentrant subscription callbacks cannot leave a newly mounted reader permanently stale. Schedule missed visible updates synchronously after commit or deferred capture release, while preserving offscreen priority for hidden readers.
Pull request & contributors
Preserve host behavior lifetimes across configuration updates (0df2595)
Add context.owns(prop) to identify the last mixin writer of a host prop, even
when a later override writes the same value.
Add hostBinding(context, owner, update) for mixins that register committed DOM
configuration. Updates keep their lifetime signal; removal, owner replacement,
and Activity hiding abort it synchronously.
The host bind prop additionally accepts host-binding descriptions and nested
binding arrays through the new Binding type. Array members have independent
signals and development strict checks. Bind remains callable, and
composeBind preserves its callable result and shared lifetime semantics.
BindCallback is an alias for Bind.
Headless widgets adopt shared committed value, registration, and reference owners.
Controlled props cannot leak from suspended renders, accepted uncontrolled
requests compose before commit, and compound Combobox changes cancel together.
Host configuration updates preserve typeahead and toast work while actual
removal cleans up immediately. Caller-authored native disability and accessible
names remain authoritative.
Pull request & contributors
Own speculative work by render attempt (4b29396)
Render attempts own data read sets, client external-store observations, boundary retries, and the sparse commit index. Checkpoints roll these back together, and terminal commit candidates release all speculative ownership. Data stores retain committed subscriptions without retaining values from abandoned fiber generations.
Commit candidates publish once and retain their identity across deferred host callbacks. Capture release is independent of mutation and cannot finish a newer candidate.
Custom commit coordinators must migrate runMutation() result handling from Result | undefined to ReconcilerMutationResult<Result>: { kind: "committed", value }, { kind: "stale" }, or { kind: "failed" }. Stale candidates skip mutation and the post-mutation callback. Failed results indicate an error during publication or the callback; deferred failures are reported through the root, while synchronous failures still throw. Release prepared capture state and call captureFinished() for all returned outcomes. Successful callbacks returning undefined remain explicitly committed.
Pull request & contributors
Simplify render and data ownership (753a5d4)
Use controller identity to retire superseded actions and transitions, and keep each pending data load with its controller in one record. Consolidate speculative data dependencies into one read map while preserving thrown-read subscriptions and releasing value snapshots at commit. Server reads skip client dependency bookkeeping.
Process root and component queues through one operation with explicit fiber ownership. Invalidate each inconsistent component once when checking data and external-store snapshots.
Pull request & contributors
Keep data reads consistent across yielded renders (4b29396)
Track temporary render-time data snapshots and revalidate them before concurrent commits. Initial reads can no longer remain on an old value when hydration or refresh publishes between render chunks before subscriptions exist.
Pull request & contributors
Keep binding errors and hydration requests attached to the right commit (44a1a7e)
Attribute deferred binding errors to the declaring asset owner when multiple components share a hoisted element. Preserve ownership through metadata winner changes as well as asset acquisition and updates.
Queue event-triggered hydration until an active commit finishes instead of re-entering its render attempt. Bind and layout callbacks can focus or click a dehydrated boundary without corrupting the commit; queued replayable events still dispatch once after hydration.
Pull request & contributors
Apply host properties before updating bindings (2f02f01)
Run callback and host bindings after the host's attributes and form properties
have been applied. Widgets now follow form reassociation through later mixins,
removing the old form's reset listener and registering with the new form.
Pull request & contributors
Finish pending captures before synchronous work (16de88e)
Allow explicit flushSync and unmount to interrupt pending View Transition captures. Preserve animations through automatically scheduled synchronous work, including before-paint repairs and external-store notifications, by retaining capture ownership until readiness. Validate pending mutations, restore author styles before urgent work, suppress interrupted transition callbacks, and ignore late browser callbacks.
Automatically cancel captures whose mutation was rejected as stale or failed. Release the document animation lock and wake existing client and streamed-reveal waiters without waiting for the discarded animation, so transition-priority retries can publish promptly even when native cancellation is unavailable or throws.
Custom commit coordinators and View Transition host adapters must return { interrupt() } instead of "deferred". The operation must synchronously finish or reject the pending mutation, restore temporary host state, and release capture. Return "committed" only when both mutation and capture restoration have completed.
View Transition host adapters receive cancelTransition: true when no candidate was published. Skip the entire native animation and release capture in that case; canceledNames and cancelRootSnapshot alone only suppress individual snapshots.
Bind DOM pseudo-element handles to the transition signal. Cancel animations created through those handles at completion and reject expired handles, preventing filled animations or saved handles from affecting later transitions with the same surface names. Surface host adapters receive the lifetime signal as a fourth createSurface argument.
Pull request & contributors
Preserve focus across DOM commits (44a1a7e)
Add an optional synchronous HostConfig.commitMutation scope and a named HostCommitActivation<Instance> type for its returned activation callback. Fig DOM captures focus before host mutations and restores surviving focus afterward, then activates binding callbacks against the published tree before component useBeforePaint callbacks choose their final focus policy. Binds can focus, select, or blur without restoration overwriting their choices. Native event and custom-element callbacks may be overridden before restoration finishes; native events continue to dispatch normally. Restoration is bounded to one selection repair followed by one explicit focus attempt, including when selection repair itself fires a listener that redirects focus.
Use atomic native moves when nodes share a shadow-including root to preserve browser-managed state, including native dialog/popover membership. Ordinary insertion remains the fallback. Removed or hidden elements are not restored, and focus restoration does not request scrolling.
Pull request & contributors
Preserve text selection across DOM commits (44a1a7e)
Capture input, textarea, and DOM selection once before mutations and restore surviving boundaries and direction before useBeforePaint. Child boundaries follow surviving children instead of stale indices, so sibling edits preserve the selected text and caret position. Cover accessible shadow roots, multi-node moves, and focused descendants of editing hosts. Skip removed or reordered boundaries that no longer define a valid range, and clamp shortened text offsets. Component layout policy runs after preservation, replacing per-move callback-intent heuristics with explicit commit ordering.
Pull request & contributors
Keep native widget changes in step with input (44a1a7e)
Run native toggle, dialog dismissal, form reset, and pointer/touch cancellation events at discrete priority. This prevents a dismissed popover from reopening with stale state and closing another popup opened by the next click.
Pull request & contributors
Allocate update queues only for queued hooks (cac7e07)
Keep update history and rebase state on root, state, transition, and action hooks. Memo, effect, ID, deferred-value, external-store, and stable-event hooks no longer allocate unused queue objects. Hook order, strict rendering, and Suspense retry behavior are unchanged.
Pull request & contributors
Use one child identity map (e4e38a0)
Simplify child matching with one map for explicit keys and positional children, preserving key equivalence and cleanup order.
Pull request & contributors
Prevent torn external snapshots and partial Suspense updates (cac7e07)
Validate external-store snapshots before concurrent commits, including yielded work completed by flushSync and parked commits. Retry inconsistent snapshots before publishing host mutations, and route subscription snapshot errors through render error boundaries.
Preserve skipped transition lanes across Suspense retries and urgent reveals so related updates cannot commit partially or become stranded.
Pull request & contributors
Summarize context dependencies with a bitmask (7da855d)
Replace descendant context arrays with conservative bitmasks to reduce bookkeeping during rendering. Exact consumer checks and nested-provider scoping remain unchanged, including when more than 32 contexts share a renderer.
Pull request & contributors
Preserve async run ownership through abort callbacks and Activity hiding (753a5d4)
Publish transition and action run ownership before invoking predecessor abort listeners, so reentrant starts retain their results and pending slots retire correctly. Saved starters and action runners called while hidden or unmounted now receive aborted signals without acquiring update authority or pending slots; revealing their owner restores normal behavior.
Pull request & contributors
Preserve stable-event lifetime under reentrant cleanup (753a5d4)
Publish each stable-event invocation before aborting its predecessor, and publish retirement before running unmount abort listeners. Reentrant calls now receive the correct signal and remain tracked for cleanup. Revealing an Activity no longer revives stable events or effects inside descendants that are still hidden.
Pull request & contributors
Keep deferred commits and subscription cleanup consistent (4b29396)
Revalidate store snapshots immediately before deferred host mutations. Abandon stale transactions without capturing or dispatching view-transition callbacks, then retry after releasing the prepared capture. Publish live hook callbacks and run before-layout effects only when the transaction actually commits.
Retire external-store listeners before calling subscription cleanup so synchronous notifications cannot read an unmounted or replaced store, and throwing cleanup cannot run repeatedly during error recovery.
Pull request & contributors
Preserve server DOM when hydrating deferred values (4b29396)
Match Fig's server-rendered current value during hydration even when useDeferredValue has an initial placeholder. Client-only mounts retain their placeholder behavior.
Pull request & contributors
Determine host updates during the begin phase (53dc8c7)
Determine host and text updates once during the begin phase so child reconciliation only handles identity and placement. Preserve host-requested updates when props are unchanged, parent-before-child updates, and error-boundary recovery for host update predicates.
Pull request & contributors
Read update queues without consuming them during render (cac7e07)
Render candidates read a bounded update history; commit acknowledges the observed prefix while retaining late updates and priority-rebase work. Interrupted renders and strict shadow passes no longer clone, consume, or restore shared queues. Suspense commits release only attempted queue prefixes for retry, preserving skipped priorities and updates arriving after a yield.
Pull request & contributors
Preserve root renders across initial scheduler yields (cac7e07)
Process the root update queue inside its fiber work unit so same-priority root renders arriving during the initial scheduler yield are included. The latest render now commits without needing another update to wake the root.
Pull request & contributors
Preserve author styles when a View Transition capture is abandoned (4b29396)
Restore the committed surface's author styles when snapshot validation abandons a deferred capture. Speculative view-transition-name and view-transition-class props are restored only after successful mutation.
Pull request & contributors
Preserve root render priority during urgent updates (cac7e07)
Queue and rebase root renders by lane, so urgent child updates cannot expose pending transition props. Preserve skipped root updates across render restarts and keep later synchronous root renders authoritative when deferred work resumes.
Pull request & contributors
Retain committed Suspense primary trees without cloning (9958b3c)
Reuse the committed primary forest when Suspense shows a fallback. Defer parent-link changes and lane retirement until commit, preserving hidden state, hook lifetimes, and queued updates for reveal while avoiding a recursive clone pass.
Pull request & contributors
Retry errors from abandoned renders (828b496)
Discard speculative ErrorBoundary errors and fallbacks when Suspense abandons their render. Retries revisit the failed primary beneath stable wrappers, allowing recovered content to reveal without reporting a stale error. Persistent failures report once after their fallback commits, while already committed error fallbacks remain sticky across suspension. This also prevents missing error callbacks and the development parity failure on Suspense reveal.
Pull request & contributors
Unwind render scopes through the fiber return chain (5fd36ea)
Restore context providers while searching for the boundary that handles a suspended or failed render. This removes separate ancestry scans while preserving nested fallback, hydration recovery, and commit-phase error behavior.
Preserve nested Suspense retries when a fallback also suspends. The surviving outer boundary inherits the discarded inner boundary's pending promises, so primary content can reveal without waiting for its fallback to resolve.
Pull request & contributors
Preserve hydration snapshots and release discarded data reads (4b29396)
Keep intentional server snapshots valid through deferred selective hydration while continuing to validate client snapshot reads in the same commit. Activity reveals no longer repeatedly abandon View Transition captures when server and client snapshots differ.
Release speculative data snapshots before Suspense or error-boundary rollback removes their owners from the commit index, including suspended attempts retained by committed fiber alternates.