Skip to main content

useUpdateProjectTextSetting

Updates one project text setting by key.

When to use it​

The value may be null when the API supports clearing that setting.

Setup​

Call it from a client-side React component below OvokProvider so it uses the client configured at that provider boundary.

Hook arguments​

The hook takes no configuration arguments. Call mutate(payload) when the user or workflow is ready to run the operation; the payload and result types are shown below.

TypeScript signature​

(): OvokMutationState<{ key: OvokProjectTextSettingKey; value: string | null; }, OvokProjectSettings>

Mutation state​

The operation runs only when you call mutate(payload). The payload type is { key: OvokProjectTextSettingKey; value: string | null; }; the returned promise and data carry OvokProjectSettings.

FieldMeaning
dataLatest successful result, or undefined before success.
loadingWhether the mutation is running.
errorNormalized Error from the latest failure.
mutateStarts the operation, resolves with its result, and rejects on failure.
resetClears mutation data and error state.

Request behavior​

The mutation is explicit: collect and validate the input in your UI, disable repeated submission while loading is true, handle the rejected promise, and render error near the action.

Example​

Call the mutation from an event handler and show its error beside the action.

import { useUpdateProjectTextSetting } from '@ovok/core';

type Input = Parameters<ReturnType<typeof useUpdateProjectTextSetting>['mutate']>[0];

export function UpdateProjectTextSettingExample({ input }: { input: Input }) {
const { mutate, loading, error } = useUpdateProjectTextSetting();
async function submit() {
try { await mutate(input); } catch { /* The hook exposes the error below. */ }
}
return <section>
<button disabled={loading} onClick={() => void submit()}>Submit</button>
{error && <p role="alert">{error.message}</p>}
</section>;
}