Table of Contents

Method UseDeferredValue

Namespace
Velvet
Assembly
Velvet.Docs.dll

UseDeferredValue<T>(T)

Defers commits of value changes through the Transition lane and returns the previous value during urgent re-renders. Use this to deprioritize heavy re-render inputs such as search queries.

public static T UseDeferredValue<T>(T value)

Parameters

value T

Latest value (provided by the caller).

Returns

T

First render: returns value as-is. Subsequent renders: returns the previously committed value and queues the next value as pending on the Transition lane. Render after a Transition flush: commits the pending value and returns the new value.

Type Parameters

T

Type of the value being deferred.

Remarks

Change detection matches UseStore<TStore, TSel>(Store<TStore>, Func<TStore, TSel>, IEqualityComparer<TSel>?): reference equality for objects, NaN-aware for float/double. There is no comparer argument.

UseDeferredValue<T>(T, T)

Overload taking an initialValue. On the initial render the hook returns initialValue instead of value and immediately schedules a Transition-lane re-render that defers toward value. Subsequent renders behave exactly like UseDeferredValue<T>(T).

public static T UseDeferredValue<T>(T value, T initialValue)

Parameters

value T

Latest value (provided by the caller).

initialValue T

Value returned on the initial render only.

Returns

T

The initial render returns initialValue; thereafter same as the single-arg overload.

Type Parameters

T

Type of the value being deferred.