블로그 Engineering

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

영문 기사. In IOTA SDK's client editor, a second Save click reverted changes. The merged fix makes htmx replace the card instead of nesting it.

Goiota-uz/iota-sdkhtmxCRMUI state

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

짧은 답변

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")

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{

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.

목표

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.

루프 실행

프로덕션 신호를 리뷰된 수정으로 바꾸세요.

무료 체험으로 Prilog가 실제 인시던트를 코드 수준 Pull Request로 연결하는 방식을 확인하세요.