Skip to content

Comments 0.4.4: Half-typed comments survive a reconnect

Comments 0.4.4 fixes a lost draft: a comment someone was typing when the LiveView connection dropped is now restored when it comes back, instead of being wiped.

LiveView only recovers a form after a reconnect when the form has an id. The new-comment form, the comment edit form and the decoration edit form in the comments component had none, so recovery was silently off for them and the host app’s tests logged “missing id” warnings. Each form now has an id built from the component and the comment, so several threads or several open edits on one page do not collide.

Dependencies were also refreshed; there is nothing to do beyond updating the package.

Full release notes: Comments 0.4.4

0.4.4 · 28 August 2026

Comment forms get stable DOM ids so LiveView can recover them after a disconnect (#40).

Fixed

  • The composer, comment-edit, and decoration-edit <.form>s in CommentsComponent now render an id. <.form for={%{}}> (used by all three) supplies no id of its own — only for={@changeset} does — so LiveView silently disabled form recovery for them: a comment half-typed when the socket dropped was lost on reconnect instead of restored. Surfaced as Detected a form with phx-change but missing id warnings in a host app’s test suite. Each id is keyed to the component’s own @myself plus what distinguishes the form (composer position/comment uuid, or comment uuid alone for edit/decoration) so multiple instances of this component, or multiple open comments, can’t collide.

Changed

  • Dependency lockfile refresh (no source changes).

Comment edits broadcast like creates and deletes (#38).

Fixed

  • update_comment/3 now broadcasts {:comments_updated, %{action: :updated}} on the resource’s topic after a successful body or status write, the same message create/delete already send. A host rendering a preview or count of the resource’s comments (the catalogue item form’s supplier rows) kept the old text after an in-place edit until reload, and every other subscribed session did too. broadcast: false lets delete_comment/2 keep sending :deleted exactly once. CommentsComponent also send/2s its host after a successful edit. subscribe/2 and the README live-update example now list :updated alongside create/delete/reaction — the PR that introduced the event left those copy-paste sites on the old three-action set.

Comments 0.4.4. Install or update: {:phoenix_kit_comments, "~> 0.4"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.