CRM 0.2.1: A broken custom field no longer crashes the user tables
CRM 0.2.1 fixes a crash in the CRM’s user tables. A custom user field defined without a key made the role and Organizations pages fail to open. Such fields are now left out of the column list, and the pages load.
The release also makes the CRM faster:
- The CRM overview reads its role statistics once per visit instead of twice, and counts the users of all enabled roles in one query instead of one per role.
- The user tables look up each column’s settings once per page render instead of once per cell.
Update the dependency; there is no migration and no configuration.
Full release notes: CRM 0.2.1
0.2.1 · 5 May 2026
Bug fixes and performance hardening from the PR #4 retrospective review: LiveView lifecycle correctness on the CRM landing page, an N+1 query collapse, and a per-cell render hot-path optimization. No breaking changes — patch release.
Fixed
- CRMLive lifecycle. Role-stat loading moved out of
mount/3(which fires twice per connect — HTTP + WebSocket) intohandle_params/3gated onconnected?/1. Eliminates duplicate queries on every CRM landing-page render. - N+1 across enabled roles. New
PhoenixKitCRM.RoleSettings.list_enabled_with_user_counts/0issues a single GROUP BY with a left join overRoleAssignment, replacing oneRoles.count_users_with_role/1round-trip per role. Roles with zero users still surface (count = 0) thanks to the left join. - Per-cell
available_columns/1recomputation. Custom-cell render no longer rebuilds the full[{id, meta}]list per cell. Views computeColumnConfig.column_metadata_map/1once per render and pass the resolved map throughrender_cell/3,card_field/3,column_label/2, andCellFormat.render_custom_cell/3.ColumnModaldoes the same lookup once at the top of the function component. - Unguarded
field["key"]in custom-field columns. Malformed custom field definitions (no"key") no longer crash the page withArgumentError: argument for <> is not a binary— they’re filtered upstream of theEnum.map. - Gettext call-style consistency in
CRMLive. Switched long-formGettext.gettext/dngettext(PhoenixKitWeb.Gettext, …)to the shortgettext/ngettextalready in scope viause PhoenixKitWeb, :live_view, matchingRoleView/OrganizationsView.
Added
PhoenixKitCRM.ColumnConfig.column_metadata_map/1— flat%{column_id => meta}map for callers that need lookup-by-id without rebuilding the available-columns list per call.PhoenixKitCRM.RoleSettings.list_enabled_with_user_counts/0— single GROUP BY query for the CRM overview.
Changed
PhoenixKitCRM.Web.CellFormat.render_custom_cell/3second arg is now acolumn_metamap (not a scope). Internal callers within CRM are updated;CellFormatwas introduced in 0.2.0’s PR #4 follow-ups and has not been released until now, so no upgraders are affected.- Dependencies refreshed via
mix deps.update --all:bandit,ecto,jason,leaf,phoenix,phoenix_kit,phoenix_live_view,postgrex. Patch / minor only — no constraint changes inmix.exs.
CRM 0.2.1. Install or update: {:phoenix_kit_crm, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.