ブログ 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.

よくある質問

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 に結びつける方法をご確認ください。