Files
twenty/packages
Sonarly Claude Code ec8ffa0313 fix: reset form with saved values after object rename to fix consecutive edits
https://sonarly.com/issue/17321?type=bug

After renaming an object in Settings, the form's dirty tracking state is cleared without updating default values, causing subsequent rename attempts to be silently skipped due to a race condition between the async save and user input.

Fix: Replaced `formConfig.reset(undefined, { keepValues: true })` with a proper `formConfig.reset()` call that passes the saved values from the mutation response.

**Before:** The `else` branch (when `isLabelSyncedWithName` didn't change) called `formConfig.reset(undefined, { keepValues: true })`, which cleared `dirtyFields` without updating `defaultValues` to the saved state. This caused React Hook Form to lose track of which fields were dirty, making subsequent edits appear "clean" and silently skipping the save.

**After:** The form is always reset with explicit values from the mutation response (falling back to the current prop values). This synchronizes both `defaultValues` and form values to the saved state, so subsequent edits are correctly detected as dirty. This is consistent with how the `if` branch already handled the `isLabelSyncedWithName` toggle case.

Also extracted `updatedObjectData` to avoid repeated `updatedObject?.data?.updateOneObject` access, and simplified the `updatedObjectNamePlural` reference below.
2026-03-22 16:49:01 +00:00
..
2026-03-17 11:43:17 +01:00