moonming opened a new pull request, #3423:
URL: https://github.com/apache/apisix-dashboard/pull/3423

   ## What
   
   Fixes #3414 (**silent data loss**).
   
   Opening a route/service/stream-route whose **inline upstream has health 
checks**, clicking **Edit**, and clicking **Save without changing anything** 
silently deleted `upstream.checks`. The green "Edit … Successfully" toast made 
the loss invisible. Reproduced against a real APISIX before fixing.
   
   ## Root cause
   
   The detail pages reset their form with `produceToNestedUpstreamForm`, which 
wrote the `__checksEnabled` UI flags **nested** under `upstream.` — but 
`FormSectionChecks` registers and reads those flags at the form **root**. After 
the reset (triggered by the mount-time background refetch), the root flag read 
`undefined` → the checks section rendered as "disabled" → its inputs unmounted 
→ `shouldUnregister: true` dropped `upstream.checks` from the PUT body → the 
Admin API PUT replaced the resource without checks.
   
   ## How
   
   - `produceToNestedUpstreamForm` now derives the root-level 
`__checksEnabled`/`__checksPassiveEnabled` from the nested upstream's checks 
(`src/components/form-slice/FormPartUpstream/util.ts`)
   - `stream_routes/detail.$id.tsx` resets through the producer (it reset with 
the raw API value, so the flags were never computed there at all)
   
   ## Verification — including a RED check
   
   - new regression e2e 
`e2e/tests/regression/form.noop-edit-preserves-checks.spec.ts` (route + service 
variants): seeds a resource with checks via the Admin API, **loads the detail 
page directly** (full page load — the bug only reproduces on a fresh mount), 
waits for the detail queries to settle (the exact reset that wiped the flags), 
performs a no-op Edit→Save, then asserts via the Admin API that 
`upstream.checks` survived
   - **verified the spec fails on the unfixed code** (route variant catches the 
wipe; the PUT body captured during debugging shows the upstream stripped of 
`checks`) and passes with the fix — the timing subtlety is documented in the 
spec
   - also re-verified manually in a live environment: unfixed → checks GONE 
after no-op save; fixed → PRESERVED
   - `pnpm lint` clean, `tsc -b` clean


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to