Closes #16792 ## Problem When editing a currency field’s default value (for example, changing from **USD** to **UYU**), the **Save** button remained disabled. However, if the format setting was changed first (**short → full → short**), the Save button would then work correctly for currency changes. ## Root Cause The form was using **React Hook Form’s `values` mode**, which did not properly track dirty state for the `defaultValue` and `settings` fields. ## Solution Switched to the **`defaultValues` + `reset()`** pattern: - Initialize the form with `defaultValues` (using placeholder values) - Call `reset()` when `fieldMetadataItem` loads This correctly tracks dirty state by comparing against the most recent `reset` values. ## Note A similar pattern is used in: - `useWebhookForm` - `useImapSmtpCaldavConnectionForm` Those hooks call `reset()` via query callbacks. In this case, `reset()` is called inside a `useEffect` because the data comes from synchronous Recoil state rather than an async query. Found two solutions to the problem, created commits for both. I feel the useEffect pattern makes more sense here since it's cleaner in terms of code. --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Run yarn dev while server running on port 3000