Skip to content

Commit

Permalink
Improve UX for adding relationship form element
Browse files Browse the repository at this point in the history
Clicking edit on a newly added (not saved to the db) field, then
clicking cancel will no longer delete the element. That will only happen
if you click cancel immediately after adding the new element.

The save button in the form element panel will always be enabled when
first configuring a new field input element. Previously the only way
to add a new relationship field without making an unnecessary config
edit was to click the x, since the Save button was disabled and the
cancel button would remove the element from the form.
  • Loading branch information
kalilsn committed Mar 3, 2025
1 parent 61d5372 commit 5c0536a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export const InputComponentConfigurationForm = ({ index, fieldInputElement }: Pr
data-testid="save-configuration-button"
type="submit"
className="bg-blue-500 hover:bg-blue-600"
disabled={!form.formState.isDirty}
disabled={!form.formState.isDirty && fieldInputElement.configured}
>
Save
</Button>
Expand Down
2 changes: 1 addition & 1 deletion core/app/components/FormBuilder/FormBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function FormBuilder({ pubForm, id, stages }: Props) {
[elements]
);
const removeIfUnconfigured = useCallback(() => {
if (panelState.selectedElementIndex === null) {
if (panelState.selectedElementIndex === null || panelState.backButton !== "selecting") {
return;
}
const element = elements[panelState.selectedElementIndex];
Expand Down

0 comments on commit 5c0536a

Please sign in to comment.