DSingh0304 opened a new pull request, #3295: URL: https://github.com/apache/apisix-dashboard/pull/3295
**Why submit this pull request?** - [x] Bugfix - [ ] New feature provided - [ ] Improve performance - [ ] Backport patches **What changes will this PR take into?** This PR fixes a bug where the `pass_host` field in Upstream configurations was incorrectly resetting to its default value (`"pass"`) when editing Upstream Nodes. **Problem:** The forms in the detail pages (Upstream, Route, Service, Stream Route) use `shouldUnregister: true`. When editing nodes, parts of the form re render and re register fields. Without explicit `defaultValues` provided to `useForm`, these fields were falling back to their component level `defaultValue` props (which is `"pass"` for `pass_host`) instead of retaining their actual state. **Solution:** - Updated the `useForm` initialization in `src/routes/upstreams/detail.$id.tsx`, `src/routes/routes/detail.$id.tsx`, `src/routes/services/detail.$id/index.tsx`, and `src/routes/stream_routes/detail.$id.tsx`. - Explicitly associated `defaultValues` (sourced from the fetched data) with the `useForm` hook. This ensures that fields retain their correct values even when they are unregistered and re registered. **Related issues** fix #3294 **Checklist:** - [x] Did you explain what problem does this PR solve? Or what new features have been added? - [x] Have you added corresponding test cases? - [ ] Have you modified the corresponding document? - [x] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first -- 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]
