Overview
useUserActions is a low-level hook that provides direct access to the Redux actions and API mutations for the current user. In most cases you should use useUser instead, which wraps useUserActions and provides a higher-level interface.
Use useUserActions directly when you need to manually set or clear user state — for example, in a custom authentication flow.
Usage Example
Return Values
Manually sets the current user in Redux state. Validates that the user object has an
id before setting — partial or empty objects are silently ignored.Clears the current user from Redux state and resets any error.
updateUser
(params: { projectId: string; userId: string; update: UpdateUserParams; currentUser?: AuthUser }) => Promise<AuthUser>
Calls the update user API and manages loading and error state. Applies optimistic updates for non-file fields. Reverts to
currentUser if the request fails.Clears any error stored in the user slice.
Prefer
useUser for typical profile management. useUserActions is intended for cases where you need direct control over user state, such as custom authentication integrations.
