Browse Source

🐛 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
t0ng7u 6 months ago
parent
commit
ebaaecb9d9

+ 0 - 4
web/src/components/table/models/modals/UpstreamConflictModal.jsx

@@ -258,10 +258,6 @@ const UpstreamConflictModal = ({
       }))
       }))
       .filter((x) => x.fields.length > 0);
       .filter((x) => x.fields.length > 0);
 
 
-    if (payload.length === 0) {
-      onClose?.();
-      return;
-    }
     const ok = await onSubmit?.(payload);
     const ok = await onSubmit?.(payload);
     if (ok) onClose?.();
     if (ok) onClose?.();
   };
   };