mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 17:57:26 +00:00
🐛 fix(models-sync): allow sync when no conflicts selected
When syncing official models, clicking "Apply overwrite" with zero selected conflict fields resulted in no request being sent and the modal simply closing. This blocked creation of missing models/vendors even though the backend supports an empty `overwrite` array and will still create missing items. Changes: - Remove the early-return guard in `UpstreamConflictModal.handleOk` - Always call `onSubmit(payload)` even when `payload` is empty - Keep closing behavior when the request succeeds Behavior: - Users can now proceed with upstream sync without selecting any conflict fields - Missing models/vendors are created as expected - Existing models are not overwritten unless fields are explicitly selected Affected: - web/src/components/table/models/modals/UpstreamConflictModal.jsx Quality: - Lint passes - No breaking changes - No visual/UI changes beyond the intended behavior Test plan: 1) Open official models sync and trigger a conflicts preview 2) Click "Apply overwrite" without selecting any fields 3) Expect the sync to proceed and a success toast indicating created models 4) Re-try with some fields selected to confirm overwrites still work
This commit is contained in:
@@ -258,10 +258,6 @@ const UpstreamConflictModal = ({
|
||||
}))
|
||||
.filter((x) => x.fields.length > 0);
|
||||
|
||||
if (payload.length === 0) {
|
||||
onClose?.();
|
||||
return;
|
||||
}
|
||||
const ok = await onSubmit?.(payload);
|
||||
if (ok) onClose?.();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user