PhoenixKit 1.7.225: Saving notification preferences no longer undoes other changes
PhoenixKit 1.7.225 fixes several ways a user’s stored custom fields could lose changes without an error.
Saving notification preferences rewrote the user’s whole custom fields map from the copy the page had loaded. A Telegram connection or a language switch made in the meantime was reverted. Preferences now write only their own key.
On users whose custom fields column was empty (NULL), adding or removing a field reported success and wrote nothing. That now works.
Internal settings of the media browser and the canvas viewer, such as media_view_mode and etcher_colors, no longer show up as admin custom fields or in the users table column picker. Ones already registered stay until you remove them.
Full release notes: PhoenixKit 1.7.225
1.7.225 · 31 July 2026
Fixed
- A NULL
custom_fieldscolumn silently swallowed atomic writes (#675) — the column is nullable (V18), and in PostgresNULL || jsonbisNULLandNULL - keystaysNULL.merge_user_custom_fields/3anddelete_user_custom_field/3built their UPDATE straight off the column, so on a NULL row the merge discarded the additions and returned{:ok, user}with nothing written. Both fragments nowCOALESCE(?, '{}'::jsonb)first — the same idiom V30 already uses — which also restores the old whole-map path’s side effect of normalizing a NULL column to{}on any delete. - Saving notification preferences rolled back a concurrently-connected channel
or locale switch —
Notifications.Prefswas the last core writer still replacing the wholecustom_fieldsmap, and it rebuilt it from the%User{}the caller had been holding sincemount/3. With a settings page open, a Telegram connect (notification_channel:telegram) or any language switch (preferred_locale) landing in between was silently reverted by the next save. It now writes only its own key through the atomic merge, which is whatChannelConfig’s per-channel key layout always assumed. Same-key concurrent writes are still last-writer-wins, now documented onPrefs.merge/2. - Internal UI preferences no longer register themselves as admin custom
fields —
ensure_definitions_exist/1registers every key in the map it is handed, and the media browser / canvas viewer passed the whole column, somedia_view_mode,media_expanded_folders,media_sidebar_collapsed,etcher_colors,etcher_line_paramsandmedia_viewer_info_collapsedappeared in the Custom Fields list and the users-table column customizer. Those five call sites now passensure_definitions: false, matching the users and activity list views. Definitions already registered on existing installs stay until removed.
Changed
update_user_locale_preference/2gained a@specdocumenting its two error shapes —{:error, String.t()}for a validation failure and the primitives’{:error, :not_found}for a row deleted concurrently.Prefs.update/2andPrefs.merge/2specs corrected to{:error, :not_found}; they no longer return anEcto.Changeset. Both call sites already matched{:error, _}.
Tests
- NULL-column coverage for the merge and delete primitives; the documented
{:error, :not_found}contract forset_user_custom_field/3; and a regression test that a siblingcustom_fieldskey written after a caller’s snapshot survives aPrefs.merge/2.
PhoenixKit 1.7.225. Install or update: {:phoenix_kit, "~> 1.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.