Refactor: Implement documentation plan

This commit is contained in:
gpt-engineer-app[bot]
2025-10-31 12:53:45 +00:00
parent c70c5a4150
commit 4f24eaf204
7 changed files with 1867 additions and 1 deletions

View File

@@ -15,6 +15,39 @@ interface ProfileUpdateParams {
};
}
/**
* Hook for profile update mutations
*
* Features:
* - Optimistic updates for instant UI feedback
* - Automatic rollback on error
* - Smart cache invalidation (profile, stats, activity)
* - Conditional search invalidation when name changes
* - Comprehensive error handling with toast notifications
*
* Modifies:
* - `profiles` table
*
* Cache Invalidation:
* - User profile data (`invalidateUserProfile`)
* - Profile stats (`invalidateProfileStats`)
* - Profile activity feed (`invalidateProfileActivity`)
* - User search results if name changed (`invalidateUserSearch`)
*
* @example
* ```tsx
* const mutation = useProfileUpdateMutation();
*
* mutation.mutate({
* userId: user.id,
* updates: {
* display_name: 'New Name',
* bio: 'Updated bio',
* website: 'https://example.com'
* }
* });
* ```
*/
export function useProfileUpdateMutation() {
const queryClient = useQueryClient();
const {