Lynx

genui / openui / useSetDefaultValue

useSetDefaultValue()

function useSetDefaultValue(shouldTriggerSaveCallback: object): void

Persists a component's default/initial value into form state once streaming finishes — but only if the user hasn't already set a value.

Call this inside any form component that has a defaultValue or defaultChecked prop. It is a no-op during streaming so that LLM prop changes don't fight with partial state.

Parameters

ParameterTypeDescription
shouldTriggerSaveCallbackobjectDefaults to false (only local state, no message persistence).
shouldTriggerSaveCallback.componentType?string-
shouldTriggerSaveCallback.defaultValueunknown-
shouldTriggerSaveCallback.existingValueunknown-
shouldTriggerSaveCallback.formName?string-
shouldTriggerSaveCallback.namestring-
shouldTriggerSaveCallback.shouldTriggerSaveCallback?boolean-

Returns

void

Defined in

@lynx-js/genui/openui/src/core/context.tsx:182

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.