From c3560cea9bb8655db4f39f514e733ecf00f3d3cf Mon Sep 17 00:00:00 2001 From: JohnnyT Date: Wed, 30 Sep 2026 05:03:37 -0600 Subject: [PATCH] Reads the editor's note through its block lookup block_note/2 in the editor found its block with its own Enum.find over Document.blocks/1, the same lookup block_by_id/2 in the module already does. It now reads through block_by_id/2. Every caller passes the socket's document, which block_by_id/2's %Document{} match accepts, so what the note reads is unchanged: the block's note, the empty string for a stored block with no note key, nil for an id the document no longer holds. Internal refactor; no changelog fragment. Sabotaged: making the found block's note read as empty turned four note field tests red. Gate: full mix quality green on this staged tree (3,951 of 3,951 tests, 95.3% coverage, dialyzer clean, ADR cites green). Refs: sb-n3ue --- lib/statifier_blocks/editor.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/statifier_blocks/editor.ex b/lib/statifier_blocks/editor.ex index 41223b26..8cc08e1d 100644 --- a/lib/statifier_blocks/editor.ex +++ b/lib/statifier_blocks/editor.ex @@ -3955,7 +3955,7 @@ if Code.ensure_loaded?(Phoenix.LiveView) do # stored Erlang term) has no `:note` key: it reads as the absent note. @spec block_note(Document.t(), Block.id()) :: String.t() | nil defp block_note(document, id) do - case Enum.find(Document.blocks(document), &(&1.id == id)) do + case block_by_id(document, id) do %Block{} = block -> Map.get(block, :note, "") nil -> nil end