:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(customer-analytics): edit account tags inline in the accounts list (#78589)
Arthur Moreira de Deus61008111964f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 88b8804e6ce8..aa4024126c03 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5399,9 +5399,9 @@ snapshots:scenes-app-batchexports--runs-with-data--light:hash: v1.k794b7964.4c1646577dc53efffd814b1a2e723f9da6b10d3641e979f48c5d0447859e2348.fkHuUw1l_9c3rJKSi467jx-6Nv81nNp-PjeRmsgU7l0scenes-app-customer-analytics-accounts--default--dark:- hash: v1.k794b7964.b580fe58b5ea91870e497ed4874da65a0885931374d5ef3a900895c8d1a2c26c.R7EXGKqeW0l9CV2CVI5_EqvV6d6H0IAtNH7RPOBM4tI+ hash: v1.k794b7964.90addf15179ed1e64060e0d035eedb9b8eef9af68590760316274259f2890136.WGMgyL6Xiave3FRnl-w6jcTbUhMrxwq1CFGt1iqdpREscenes-app-customer-analytics-accounts--default--light:- hash: v1.k794b7964.129b877d7f5535d72e0b834059ec989aa80494ccbc5345d258c03ab9abe1163c.77iaQiDBhgh_b_Ed0U2Xof14_2pqQlz-fyHQw_hwC78+ hash: v1.k794b7964.faa5deb2da376bb4364cc185f6ca36d5ef4e5f12af269420f106569f0847011d.I72hc0cqrIF69Nf3LBXC_FxP4Wb9n8qYouNiokLvDv4scenes-app-customer-analytics-accounts--empty--dark:hash: v1.k794b7964.892b7da6722a32bd8383152a945e4bbc30eefebf1b9daa79d615e55a969e1a52._oCcXCKvTuiGNNd4h0WZ2YoMvWXtHmgHCxHmljYucH0scenes-app-customer-analytics-accounts--empty--light:@@ -5411,21 +5411,21 @@ snapshots:scenes-app-customer-analytics-accounts--feature-gate-off--light:hash: v1.k794b7964.e8b91bf6a0dd1b5d31064f4cbb94e9791e999c210831c455a498d0c7cc7e6bbb.IkZPJrJz33sKS8zzKwoy8V3s0GvmKpe5EGYTCIljhLsscenes-app-customer-analytics-accounts--row-expanded-empty--dark:- hash: v1.k794b7964.a383176831b0ebf2861e39ef8c51e4101ac680a76791b9d3788c3a4c7a5c69e8.RuvhFxLwOrB3phJx2c2ODXhiQxNsvHHVvWTj1VTwj0E+ hash: v1.k794b7964.89995158723a826e4604ddfcf9681dc0c9b50f33219cfccd06ccce637fe1b65b.i40Oi8tI3Ey-wqAdh3EekF8ti9WEdjq6dx-6JQPSvA0scenes-app-customer-analytics-accounts--row-expanded-empty--light:- hash: v1.k794b7964.6b518220b91cff7ea974da8fe6e753abc42cba6349ce4034da9e761e55e54a3a.KMHSrirCnAIKbSLt9MoRAJXd4Jw937PDyTgUz8yC4u0+ hash: v1.k794b7964.9e34cdbfa99277db4e17ef52314317b9523ac737c8285b972460baa2b993e8ea.EQ8z6F2X7fhbbuoIctopbwQcd2nqhfDcwzEmlLgEAlMscenes-app-customer-analytics-accounts--row-expanded-links-disabled--dark:- hash: v1.k794b7964.50070e51329d53d9bd8e2a3d3ac7de5c0fcea2a41b45ada94bbe92606dd47b77.QGHFTHV0y2Yhyo8idOVqnjTxkeXKGU6grBvDXIEmRLo+ hash: v1.k794b7964.385a63b277ab9041131f99759cf602d06443de6cc4e41333603d1187d64b6954.sQ8rSdSRp6Hbyvu_itGLdKOfbKjxjMSO_rxHaY4nP_0scenes-app-customer-analytics-accounts--row-expanded-links-disabled--light:- hash: v1.k794b7964.afafa36ea188644ed6530cae825cb99aa320939c21d5b95a72f4481bdee62ae7.yW1V7yaSl4o_ddcF9iC91zMVTwnILOmXhjBPfs63clQ+ hash: v1.k794b7964.f0b2c185b0a9587edc280cb10f5e1917b05527e8218dc3bf745e23a3554c224d.zAJKffRe5BstVe68Qdk9rLyZr937OsLrmJXQrPYynx4scenes-app-customer-analytics-accounts--row-expanded-usage-not-found--dark:- hash: v1.k794b7964.8bd7486f2b15f90d463f39fd447c71ef14f037e67b181332938ae22f9f9b1512.6g4GcZDm3J396htOBYLxm64-pdJ0ze8u8PjhxkY24wQ+ hash: v1.k794b7964.2b808e25f00ad2e3368b04d4a47e4faac7893d55f7ea8371c7c1cafc35c52536.zItumxxVofp2swh3Vq3Qz63JQmcvGseX8wdZRgOsuU4scenes-app-customer-analytics-accounts--row-expanded-usage-not-found--light:- hash: v1.k794b7964.07cdc60aac4d54b6ef86e48e4e0edd71eb480ce16e6293a6dd5f8c6d018c7139.-63YcQgoEWb4xgACeP2HdXleFzbO8q-LQdsS9Posxo8+ hash: v1.k794b7964.6daf7da6b08f898cecd3ba6564bfe299cccaec8584e8b9b369b472daf4478ec9.ovxGnefEu6NiHHJaxUefBQkG0LsexH2oVEhpSuwXy7cscenes-app-customer-analytics-accounts--row-expanded-with-note--dark:- hash: v1.k794b7964.cffe67e064b3b805bea6d329c50adaf707bf3301fe1b2f3238de95892f4891a6.DV5QQ7TSYsDgkK6keu8_sR-FHdZ3pZze9S7c5fXGuTg+ hash: v1.k794b7964.51cb259a2c15fffd01faba298f9dc78e545e41a5c645a36558f4b0099e1fb13b.p5Z_YR55_z21ZLe8GhPEzIYdxnP3E2im9Ug9gdCFhX4scenes-app-customer-analytics-accounts--row-expanded-with-note--light:- hash: v1.k794b7964.dba927090806c0d069eef568d8fc90ed12d4e6829ddb8c82126ea8958e1e7adb.jxpKvcSTRjyCgkzKolV5udbLmFeipTN1ZOdS1qsKFHA+ hash: v1.k794b7964.cd3a16daa69e96a5aaff1c285abd83819ac41c7af57f9d0f95f76fd5c8ed33ac.3xfRcw5si_dACFzJVLIocauVC1RCZgwwXnxnRJTlOh4scenes-app-customer-analytics-dashboard--b-2-b-mode-with-groups-enabled--dark:hash: v1.k794b7964.cf03f6a65f846aec287042028193b834c567f01226d2e91f6389df5af935530d.bXzRv9MkU0nXN-4tvGbenagVaJuhFr86goke8HVYFJYscenes-app-customer-analytics-dashboard--b-2-b-mode-with-groups-enabled--light:diff --git a/frontend/src/lib/components/ObjectTags/ObjectTags.tsx b/frontend/src/lib/components/ObjectTags/ObjectTags.tsxindex b396c2e92956..dcf08af4e4c1 100644--- a/frontend/src/lib/components/ObjectTags/ObjectTags.tsx+++ b/frontend/src/lib/components/ObjectTags/ObjectTags.tsx@@ -16,6 +16,8 @@ interface ObjectTagsPropsBase {className?: stringactionButtonSize?: ComponentProps<typeof LemonTag>['size']'data-attr'?: string+ /** Makes each displayed tag clickable, e.g. to filter by it. */+ onTagClick?: (tag: string) => void}export type ObjectTagsProps =@@ -53,6 +55,7 @@ export function ObjectTags({className,actionButtonSize = 'small','data-attr': dataAttr,+ onTagClick,}: ObjectTagsProps): JSX.Element {const objectTagId = useId()const logic = objectTagsLogic({ id: objectTagId, onChange })@@ -99,7 +102,11 @@ export function ObjectTags({.filter((t) => !!t).map((tag, index) => {return (- <LemonTag key={index} type={COLOR_OVERRIDES[tag] || colorForString(tag)}>+ <LemonTag+ key={index}+ type={COLOR_OVERRIDES[tag] || colorForString(tag)}+ onClick={onTagClick ? () => onTagClick(tag) : undefined}+ >{tag}</LemonTag>)diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.mdindex c1945d981e62..cc012979212b 100644--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md@@ -62,6 +62,8 @@ AccountsTabContent ── binds dataNodeLogic(ACCOUNTS_HOGQL_DATA_NODE_KEY, acc- **`name` column** (mandatory, `ACCOUNTS_NAME_COLUMN`) — emitted as `tuple(name, external_id, id)`, read as `{ name, external_id, id }`. This is the row's identity: `id` (the account PK) drives expansion/scroll/role updates; `external_id` is the copy-able group key. `getNameCell()` in `AccountsHogQLTable.tsx` is the canonical accessor; never assume a column index. In `NameCell` the name renders as the prominent (`font-semibold`) primary label: a plain click opens the account details inline (toggles the row's expansion via `accountsExpansionLogic`, firing `AccountOpened` on open), while the `<Link>` href points at `urls.customerAnalyticsAccount(id)` so cmd/ctrl-click opens the account's deep-link page in a new tab. The `external_id` sits beneath it as de-emphasized (`text-xs text-muted`) copy-to-clipboard text.- **relationship columns** — backed by the ``accounts.relationships.values.`<definition_id>` `` lazy join, emitted as the **array of active assignee user ids** (`[]` when unassigned). The legacy names `csm`/`account_executive`/`account_owner` remain the STORED column names (in defaults, saved views, and URL state) and are translated into the lazy-join expression at query-build time by `translateSelectColumns` in `accountsColumnConfigLogic`, matched by seeded definition name (`LEGACY_ROLE_COLUMNS`); a legacy column with no matching definition is dropped from the query. Other definitions are pickable from the "Relationships" column group with opaque `rel_<id>` aliases, resolved back via `aliasToRelationshipDefinition`. Cells render `RelationshipCell`: single-holder definitions get an editable `MemberSelect` (writes via the relationships assign/end endpoints — assign auto-ends the previous holder server-side); multi-holder definitions render read-only. User ids resolve to members via `membersLogic` (loaded up front in `accountsLogic.afterMount`). Sorting uses the alias directly (arrays of ids — deterministic but not email order).+The `tag_names` cell is editable in place: `TagsCell` renders the editable `ObjectTags` variant (available tags from `tagsModel`), saving through the account PATCH via `accountsLogic.updateAccountTags` — optimistic per-account override (`tagOverrides`, masking the stale HogQL cell like `relationshipOverrides`), debounced full-list PATCH (`TAGS_SAVE_DEBOUNCE_MS`, since `ObjectTags` fires per added/removed tag), `savingTags` guard, revert + toast + captured exception on failure. Clicking a tag in the cell adds it to the tags filter, compounding with tags already filtered (`addTagToFilter` — dedupes, and reports through `reportFilterChange('tag')` like the filter control).+Default columns: `name`, `tag_names`, `notebook_count`, plus one relationship column per team definition. `ACCOUNTS_HOGQL_DEFAULT_SELECT` (base columns only) is just the pre-load seed; once `loadRelationshipDefinitionsSuccess` fires, still-default columns are upgraded to the `defaultSelectColumns` selector (seeded definitions keep their legacy bare names, others get `rel_<id>` expressions) — anything already customized by the user, a saved view, or a shared URL is left alone, and the URL hash serializes columns only when they differ from `defaultSelectColumns`. The name column is force-kept (`ensureNameColumn`) — removing it breaks identity, scroll, and role edits. Extra columns come from account properties, lazy/virtual-table joins under `system.accounts`, data-warehouse joins, freeform SQL, or **custom properties** — all assembled by `buildAccountColumnGroups`.**Custom property columns** surface the team's `CustomPropertyDefinition`s (loaded in `accountsColumnConfigLogic` via the generated `customPropertyDefinitionsList`) as a "Custom properties" picker group. Each is selected as ``accounts.custom_properties.values.`<definition-id>` AS cp_<id>`` — a JSON dot-access through the `custom_properties` lazy join on `system.accounts` (backed by the `customer_analytics_custompropertyvalue` EAV table; one JOIN regardless of column count). Because the alias is an opaque `cp_<id>`, every label-bearing surface must resolve it back via the `aliasToDefinition` selector: the table header (`useContextColumns` in `AccountsHogQLTable`) and the configurator's "Visible columns" list (`SelectedAccountColumn`). Cells render by display type (`CustomPropertyCell`: date→`TZLabel`, boolean→icon, select→`LemonColorGlyph` + label, numeric→`formatCustomPropertyValue`). Sorting a numeric custom property (display type `number`/`currency`/`percent`) casts the (string) JSON value with `toFloatOrNull(...)` in the `orderBy` — see `orderByExpression` in `accountsLogic`, driven by `aliasToDefinition` — so numbers sort by magnitude rather than lexically; non-numeric types sort by the alias directly. The stored sort state (URL hash, saved views) keeps the clean column name; the cast is applied only at query-build time. Numeric custom properties are also selectable in the **overview tiles** sum/avg/min/max/median/threshold pickers — `numericColumnOptions` recognizes the display type and wraps the value in `toFloatOrNull(...)` the same way so aggregation is numeric.@@ -250,6 +252,7 @@ We track user actions on the Accounts list with `posthog.capture()`. Conventions| `customer analytics accounts view selected` | `accountsViewsLogic` `applyView` listener | `visibility` || `customer analytics accounts view deleted` | `accountsViewsLogic` `deleteViewSuccess` listener | _(none)_ || `customer analytics account role assigned` | `accountsLogic` `updateAccountRole` | `role` (`csm` \| `account_executive` \| `account_owner` for the seeded definitions, else the definition name), `is_assigned`, `assigned_user_id`, `source` (`list_row` from `accountsLogic.updateAccountRole` \| `relationships_tab` from `accountRelationshipsLogic` assign/end) |+| `customer analytics account tags updated` | `accountsLogic` `updateAccountTags` listener (after the debounced PATCH succeeds; dispatched by the tags cell editor) | `tag_count` (tag names kept out — they can name customers) || `customer analytics account link clicked` | `AccountNotebooksExpansion.tsx` useful-link `onClick` (incl. the "Copy link to account" row, `link_key: 'copy-account-link'`) | `link_key`, `has_destination` || `customer analytics account note clicked` | `AccountNotebooksExpansion.tsx` note `<Link>` `onClick` | `notebook_short_id` || `customer analytics accounts note created` | `accountNotebooksLogic` `createNoteSuccess` listener | `notebook_short_id` |diff --git a/products/customer_analytics/frontend/components/Accounts/AccountsHogQLTable.tsx b/products/customer_analytics/frontend/components/Accounts/AccountsHogQLTable.tsxindex eaea965e5936..ff50a8a50582 100644--- a/products/customer_analytics/frontend/components/Accounts/AccountsHogQLTable.tsx+++ b/products/customer_analytics/frontend/components/Accounts/AccountsHogQLTable.tsx@@ -20,6 +20,7 @@ import { percentage } from 'lib/utils/numbers'import { membersLogic } from 'scenes/organization/membersLogic'import { urls } from 'scenes/urls'+import { tagsModel } from '~/models/tagsModel'import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'import { DataTable } from '~/queries/nodes/DataTable/DataTable'import { DataTableNode } from '~/queries/schema/schema-general'@@ -133,10 +134,28 @@ function NameCell({ record }: { record: unknown }): JSX.Element {}function TagsCell({ record }: { record: unknown }): JSX.Element {+ const { isTagsSaving, tagOverrides } = useValues(accountsLogic)+ const { updateAccountTags, addTagToFilter } = useActions(accountsLogic)+ const { visibleColumnNames } = useValues(accountsColumnConfigLogic)+ const { tags: tagsAvailable } = useValues(tagsModel)const getCell = useGetCell()const raw = getCell(record, 'tag_names')- const tags = Array.isArray(raw) ? (raw.filter((t) => typeof t === 'string') as string[]) : []- return tags.length > 0 ? <ObjectTags tags={tags} staticOnly /> : <span className="text-muted">—</span>+ const cellTags = Array.isArray(raw) ? (raw.filter((t) => typeof t === 'string') as string[]) : []+ const accountId = getNameCell(record, visibleColumnNames)?.id+ if (!accountId) {+ return cellTags.length > 0 ? <ObjectTags tags={cellTags} staticOnly /> : <span className="text-muted">—</span>+ }+ const tags = tagOverrides[accountId] ?? cellTags+ return (+ <ObjectTags+ tags={tags}+ onChange={(newTags) => updateAccountTags(accountId, newTags)}+ onTagClick={addTagToFilter}+ saving={isTagsSaving(accountId)}+ tagsAvailable={(tagsAvailable || []).filter((tag) => !tags.includes(tag))}+ data-attr="accounts-tags-cell"+ />+ )}function NotebookCountCell({ record }: { record: unknown }): JSX.Element {diff --git a/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.tsindex 1d31875967aa..aae4054cc23e 100644--- a/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.ts@@ -12,12 +12,14 @@ import type { UserBasicType, UserType } from '~/types'import {accountRelationshipDefinitionsList,+ accountsPartialUpdate,accountsRelationshipsCreate,accountsRelationshipsEndCreate,accountsRelationshipsList,customPropertyDefinitionsList,} from 'products/customer_analytics/frontend/generated/api'import type {+ AccountApi,AccountRelationshipApi,AccountRelationshipDefinitionApi,CustomPropertyDefinitionApi,@@ -45,6 +47,7 @@ jest.mock('products/customer_analytics/frontend/generated/api', () => ({...jest.requireActual('products/customer_analytics/frontend/generated/api'),accountRelationshipDefinitionsList: jest.fn(),customPropertyDefinitionsList: jest.fn(),+ accountsPartialUpdate: jest.fn(),accountsRelationshipsCreate: jest.fn(),accountsRelationshipsEndCreate: jest.fn(),accountsRelationshipsList: jest.fn(),@@ -61,6 +64,7 @@ const mockRelationshipsEnd = accountsRelationshipsEndCreate as jest.MockedFunctitypeof accountsRelationshipsEndCreate>const mockRelationshipsList = accountsRelationshipsList as jest.MockedFunction<typeof accountsRelationshipsList>+const mockPartialUpdate = accountsPartialUpdate as jest.MockedFunction<typeof accountsPartialUpdate>const DEFINITIONS: AccountRelationshipDefinitionApi[] = [{ id: 'def-csm', name: 'CSM', description: null, is_single_holder: true },@@ -77,6 +81,17 @@ const buildRelationship = (overrides: Partial<AccountRelationshipApi> = {}): Acc...overrides,})+const buildAccount = (overrides: Partial<AccountApi> = {}): AccountApi => ({+ id: 'acc-1',+ name: 'Acme',+ tags: [],+ notebooks: [],+ created_at: '2026-01-01T00:00:00Z',+ created_by: null,+ updated_at: null,+ ...overrides,+})+const buildUser = (overrides: Partial<UserBasicType> = {}): UserBasicType =>({id: 42,@@ -746,4 +761,42 @@ describe('accountsLogic', () => {await expectLogic(logic).toFinishAllListeners()})})++ describe('updateAccountTags', () => {+ it('masks the cell optimistically and collapses an editing burst into one PATCH with the final list', async () => {+ mockPartialUpdate.mockResolvedValue(buildAccount({ tags: ['vip', 'churn-risk'] }))++ logic.actions.updateAccountTags('acc-1', ['vip'])+ expect(logic.values.tagOverrides['acc-1']).toEqual(['vip'])+ logic.actions.updateAccountTags('acc-1', ['vip', 'churn-risk'])+ expect(logic.values.tagOverrides['acc-1']).toEqual(['vip', 'churn-risk'])+ await expectLogic(logic).toFinishAllListeners()++ expect(mockPartialUpdate).toHaveBeenCalledTimes(1)+ expect(mockPartialUpdate).toHaveBeenCalledWith(String(MOCK_DEFAULT_TEAM.id), 'acc-1', {+ tags: ['vip', 'churn-risk'],+ })+ })++ it('reverts the optimistic override and clears saving on failure', async () => {+ mockPartialUpdate.mockRejectedValueOnce(new Error('boom'))++ logic.actions.updateAccountTags('acc-1', ['vip'])+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.tagOverrides['acc-1']).toBeUndefined()+ expect(logic.values.isTagsSaving('acc-1')).toBe(false)+ })+ })++ describe('addTagToFilter', () => {+ it('compounds clicked tags into the filter and ignores tags already filtered', async () => {+ logic.actions.addTagToFilter('vip')+ logic.actions.addTagToFilter('churn-risk')+ logic.actions.addTagToFilter('vip')+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.tagsFilter).toEqual(['vip', 'churn-risk'])+ })+ })})diff --git a/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsLogic.tsindex 0589d664434f..d670da8330e5 100644--- a/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts@@ -11,12 +11,14 @@ import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'+import { tagsModel } from '~/models/tagsModel'import { type DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'import type { DataTableRow } from '~/queries/nodes/DataTable/dataTableLogic'import { AccountsQuery, DataNode, DataTableNode, NodeKind, RefreshType } from '~/queries/schema/schema-general'import type { AccountCustomPropertyFilter, UserBasicType } from '~/types'import {+ accountsPartialUpdate,accountsRelationshipsCreate,accountsRelationshipsEndCreate,accountsRelationshipsList,@@ -47,6 +49,10 @@ import { AccountsEvents } from './constants'export const SEARCH_DEBOUNCE_MS = 300+// ObjectTags fires onChange per added/removed tag; the debounce collapses an+// editing burst into one full-list PATCH.+export const TAGS_SAVE_DEBOUNCE_MS = 300+// Revealing an off-screen account triggers an async refetch, so its row may not// be in the DOM yet — poll briefly for it before scrolling.const SCROLL_TO_ACCOUNT_POLL_MS = 100@@ -206,14 +212,17 @@ export interface accountsLogicValues {customPropertyFilters: AccountCustomPropertyFilter[]hogqlQuery: DataTableNodeisRoleSaving: (accountId: string, column: string) => boolean+ isTagsSaving: (accountId: string) => booleanlistPaginated: booleanmetricsQuery: AccountsQuery | nullrelationshipOverrides: Record<string, number[]>savingRoles: Record<string, true>+ savingTags: Record<string, true>searchInput: stringsearchQuery: stringsortOrder: AccountSortOrdersortedRowsTransformer: ((rows: DataTableRow[]) => DataTableRow[]) | undefined+ tagOverrides: Record<string, string[]>tagsFilter: string[]viewUrlState: AccountsViewUrlState}@@ -289,6 +298,9 @@ export interface accountsLogicActions {}user: UserType | null} // userLogic+ addTagToFilter: (tag: string) => {+ tag: string+ }openAccount: (accountId: string,externalId: string | null,@@ -356,6 +368,19 @@ export interface accountsLogicActions {setTagsFilter: (tags: string[]) => {tags: string[]}+ setTagsOverride: (+ accountId: string,+ tags: string[] | null+ ) => {+ accountId: string+ tags: string[] | null+ }+ tagsUpdateFinished: (accountId: string) => {+ accountId: string+ }+ tagsUpdateStarted: (accountId: string) => {+ accountId: string+ }toggleSort: (column: AccountSortableColumn) => {column: string}@@ -368,6 +393,13 @@ export interface accountsLogicActions {column: stringuser: UserBasicType | null}+ updateAccountTags: (+ accountId: string,+ tags: string[]+ ) => {+ accountId: string+ tags: string[]+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -376,6 +408,7 @@ export interface accountsLogicMeta {currentUserId: (user: UserType | null) => number | nullassignedToCurrentUser: (assignedToFilter: RoleFilterValue, currentUserId: number | null) => booleanisRoleSaving: (savingRoles: Record<string, true>) => (accountId: string, column: string) => boolean+ isTagsSaving: (savingTags: Record<string, true>) => (accountId: string) => booleanactiveFilterCount: (searchQuery: string,tagsFilter: string[],@@ -520,6 +553,13 @@ export const accountsLogic = kea<accountsLogicType>([column,userIds,}),+ updateAccountTags: (accountId: string, tags: string[]) => ({ accountId, tags }),+ // Clicking a tag in a row's tags cell adds it to the tags filter (compounding).+ addTagToFilter: (tag: string) => ({ tag }),+ tagsUpdateStarted: (accountId: string) => ({ accountId }),+ tagsUpdateFinished: (accountId: string) => ({ accountId }),+ // null drops the override, falling back to the fetched cell value.+ setTagsOverride: (accountId: string, tags: string[] | null) => ({ accountId, tags }),openAccount: (accountId: string, externalId: string | null, name: string, tab: AccountExpansionTab) => ({accountId,externalId,@@ -617,6 +657,33 @@ export const accountsLogic = kea<accountsLogicType>([}),},],+ savingTags: [+ {} as Record<string, true>,+ {+ tagsUpdateStarted: (state, { accountId }) => ({ ...state, [accountId]: true }),+ tagsUpdateFinished: (state, { accountId }) => {+ const next = { ...state }+ delete next[accountId]+ return next+ },+ },+ ],+ // Tags written from the list, keyed by account id — masks the stale HogQL+ // cell until the async refetch lands.+ tagOverrides: [+ {} as Record<string, string[]>,+ {+ setTagsOverride: (state, { accountId, tags }) => {+ const next = { ...state }+ if (tags === null) {+ delete next[accountId]+ } else {+ next[accountId] = tags+ }+ return next+ },+ },+ ],}),selectors({currentUserId: [(s) => [s.user], (user: null | import('~/types').UserType): number | null => user?.id ?? null],@@ -634,6 +701,12 @@ export const accountsLogic = kea<accountsLogicType>([(accountId: string, column: string): boolean =>!!savingRoles[savingRoleKey(accountId, column)],],+ isTagsSaving: [+ (s) => [s.savingTags],+ (savingTags: Record<string, true>) =>+ (accountId: string): boolean =>+ !!savingTags[accountId],+ ],activeFilterCount: [(s) => [s.searchQuery, s.tagsFilter, s.allRolesUnassigned, s.assignedToFilter, s.customPropertyFilters],(@@ -1003,6 +1076,38 @@ export const accountsLogic = kea<accountsLogicType>([actions.roleUpdateFinished(accountId, column)}},+ addTagToFilter: ({ tag }) => {+ if (values.tagsFilter.includes(tag)) {+ return+ }+ actions.setTagsFilter([...values.tagsFilter, tag])+ actions.reportFilterChange('tag')+ },+ updateAccountTags: async ({ accountId, tags }, breakpoint) => {+ const previous = values.tagOverrides[accountId] ?? null+ // Optimistic: ObjectTags is a controlled input firing per added/removed tag,+ // so its value must reflect each change immediately or the editor reverts.+ actions.setTagsOverride(accountId, tags)+ // ponytail: the breakpoint is per-action, not per-account — editing two+ // accounts' tags within 300ms drops the first save. Key it per account if+ // that ever becomes a real interaction.+ await breakpoint(TAGS_SAVE_DEBOUNCE_MS)+ actions.tagsUpdateStarted(accountId)+ try {+ await accountsPartialUpdate(String(values.currentTeamId), accountId, { tags })+ posthog.capture(AccountsEvents.TagsUpdated, { tag_count: tags.length })+ // A newly created tag should show up in the available-tags pickers right away.+ tagsModel.findMounted()?.actions.loadTags()+ dataNodeLogic.findMounted({ key: ACCOUNTS_HOGQL_DATA_NODE_KEY })?.actions.loadData('force_async')+ dataNodeLogic.findMounted({ key: ACCOUNTS_METRICS_DATA_NODE_KEY })?.actions.loadData('force_async')+ } catch (error) {+ actions.setTagsOverride(accountId, previous)+ posthog.captureException(error as Error, { scope: 'accountsLogic.updateAccountTags' })+ lemonToast.error('Failed to update tags')+ } finally {+ actions.tagsUpdateFinished(accountId)+ }+ },openAccount: ({ accountId, externalId, name, tab }) => {const dataNode = dataNodeLogic.findMounted({ key: ACCOUNTS_HOGQL_DATA_NODE_KEY })const results = (dataNode?.values.response as { results?: unknown[] } | undefined)?.resultsdiff --git a/products/customer_analytics/frontend/components/Accounts/constants.ts b/products/customer_analytics/frontend/components/Accounts/constants.tsindex 9f4a63398699..bbc69c095248 100644--- a/products/customer_analytics/frontend/components/Accounts/constants.ts+++ b/products/customer_analytics/frontend/components/Accounts/constants.ts@@ -41,6 +41,7 @@ export const AccountsEvents = {ViewSelected: 'customer analytics accounts view selected',ViewDeleted: 'customer analytics accounts view deleted',RoleAssigned: 'customer analytics account role assigned',+ TagsUpdated: 'customer analytics account tags updated',LinkClicked: 'customer analytics account link clicked',NoteClicked: 'customer analytics account note clicked',NoteCreated: 'customer analytics accounts note created',