From ebaaecb9d903e9b44bfc42c881c451cf1888c784 Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Wed, 3 Sep 2025 00:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(models-sync):=20allow=20sync?= =?UTF-8?q?=20when=20no=20conflicts=20selected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../components/table/models/modals/UpstreamConflictModal.jsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/web/src/components/table/models/modals/UpstreamConflictModal.jsx b/web/src/components/table/models/modals/UpstreamConflictModal.jsx index 8682ccb6..3993f6dc 100644 --- a/web/src/components/table/models/modals/UpstreamConflictModal.jsx +++ b/web/src/components/table/models/modals/UpstreamConflictModal.jsx @@ -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?.(); };