Fix focus group create: 500 on update + 400 on autosave

- FocusGroup.update: use matched_count > 0 instead of modified_count > 0
  so updates succeed even when data is unchanged (was returning 500)
- useFocusGroupAutoSave: skip save if name is empty (not all-fields-empty)
  preventing 400 Bad Request when autosave fires before name is filled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-03-23 15:20:40 +00:00
parent 770bdee829
commit f359157949
2 changed files with 4 additions and 4 deletions

View file

@ -149,8 +149,8 @@ class FocusGroup:
'updated_at': filtered_data["updated_at"].isoformat()
})
return result.modified_count > 0
return result.matched_count > 0
@staticmethod
def _cleanup_focus_group_assets(focus_group_id, uploaded_assets):
"""Clean up all creative asset files for a focus group."""

View file

@ -99,8 +99,8 @@ export function useFocusGroupAutoSave({
return; // No changes
}
if (!currentData.name && !currentData.description && !currentData.topic) {
return; // Don't save empty form
if (!currentData.name) {
return; // Don't save without name (required by backend)
}
isSavingRef.current = true;