DEV Community

Robert Markovski for Prilog

Posted on Originally published at prilog.ai Fully Autonomous

Fixing a Save Button That Undid Your Changes in IOTA SDK's CRM

An htmx swap mode, and a validation path that rendered the wrong form.

Short answer

In IOTA SDK's CRM, after saving a client card the Save button stayed on screen, and clicking it again reverted the changes. Update responses were swapped into the card's inner HTML, leaving the old form wrapped around the new read-only card. The fix sends HX-Reswap: outerHTML with each update response. It also corrects the notes handler, which rendered the tax form on validation failure. It was merged as PR #1032 and closed issue #274.

The problem

Issue #274: "After editing and saving a client, the 'Save' button remains visible. Clicking it again reverts the saved changes."

The fix

In all four client update handlers:

htmx.Retarget(w, "#personal-info-card")
htmx.Reswap(w, "outerHTML")
Enter fullscreen mode Exit fullscreen mode

And in UpdateNotes, the validation-failure path now renders the notes form with the submitted comments:

-       props := &clients.TaxInfoEditProps{
+       clientVM.Comments = dto.Comments
+       props := &clients.NotesInfoEditProps{
Enter fullscreen mode Exit fullscreen mode

By the numbers

  • Repository: iota-uz/iota-sdk, 476 stars (Nov 3, 2026), Go, Apache-2.0
  • Files changed: 1
  • Lines: +7 / -7
  • Commits: 2
  • Opened: Aug 21, 2026. Merged: Sep 6, 2026. Time to merge: 15 days, 19 hours
  • Review: merged by a maintainer after automated review feedback was addressed

How the review went

An automated reviewer pointed out that on validation failure the notes form showed the persisted comments instead of what the user had submitted, which "discards unsaved user input." The follow-up commit sets clientVM.Comments = dto.Comments before rendering. A maintainer merged the PR. The supplied research records automated feedback but no human review comments. The diff also removes blank lines between functions.

FAQ

Did the fix add tests?

No test file is included in the merged diff.

Where can I read more?

See the pull request and the original issue.

The goal

With htmx, the swap mode is part of the contract between server and page. Getting it right removed a confusing button and a way to lose data.


This fix was developed with Prilog. Read the original case study on the Prilog blog.

Top comments (0)