: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
fix(customer-analytics): expose shared saved views (#85715)
Arthur Moreira de Deus32c259af43ed
diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.mdindex d92685bd81bf..dbe770cb6874 100644--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md@@ -206,6 +206,7 @@ Views are persisted as `ColumnConfiguration` rows under `context_key = 'customer**Auto-restore:** the last-used view `id` is persisted in a team-scoped localStorage key (`currentViewId`).A shared link's `#view=` URL hash always wins over the saved `currentViewId`.+When saved views exist but the viewer has no last-used view, the selector remains available without applying a view automatically.`isDirty` is true when the live state diverges from the selected view's saved state.**One-time tiles migration:** on first load, if the signed-in user is the creator of the existing default `ColumnConfiguration` row and its `properties.tiles` is empty while their localStorage tiles differ from `DEFAULT_TILES`, `accountsViewsLogic` patches the localStorage tiles into that row.diff --git a/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsx b/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsxindex 2114a33f6b84..32cc214f422e 100644--- a/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsx+++ b/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsx@@ -10,19 +10,26 @@ import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'import { initKeaTests } from '~/test/init'import type { UserType } from '~/types'+import type { ColumnConfigurationApi } from 'products/product_analytics/frontend/generated/api.schemas'+import { ACCOUNTS_TABLE_DATA_NODE_KEY } from '../../constants'import { accountsLogic } from './accountsLogic'import { AccountsTabFilters } from './AccountsTabFilters'describe('AccountsTabFilters', () => {let logic: ReturnType<typeof accountsLogic.build>+ let savedViews: ColumnConfigurationApi[]beforeEach(() => {+ savedViews = []useMocks({get: {'/api/organizations/:organization_id/members/': () => [200, { results: [] }],'/api/projects/:team_id/tags': () => [200, []],- '/api/environments/:team_id/column_configurations': () => [200, { results: [] }],+ '/api/environments/:team_id/column_configurations': () => [+ 200,+ { count: savedViews.length, results: savedViews },+ ],},})initKeaTests()@@ -56,6 +63,29 @@ describe('AccountsTabFilters', () => {return screen.getByText('My accounts').closest('.LemonCheckbox')!.querySelector('input')!}+ it('offers shared saved views when none is selected', async () => {+ savedViews = [+ {+ id: 'shared-view',+ context_key: 'customer_analytics_accounts_columns',+ columns: ['name'],+ name: 'Shared accounts',+ filters: {},+ order_by: [],+ properties: {},+ visibility: 'shared',+ created_by: 999,+ created_at: '2026-01-01T00:00:00Z',+ updated_at: '2026-01-01T00:00:00Z',+ },+ ]+ renderFilters()++ fireEvent.click(await screen.findByText('Select view'))++ expect(await screen.findByText('Shared accounts')).toBeInTheDocument()+ })+it('renders the "My accounts" checkbox', () => {renderFilters()diff --git a/products/customer_analytics/frontend/components/Accounts/AccountsViewSelector.tsx b/products/customer_analytics/frontend/components/Accounts/AccountsViewSelector.tsxindex 4413a8f270b0..c8795ed41d19 100644--- a/products/customer_analytics/frontend/components/Accounts/AccountsViewSelector.tsx+++ b/products/customer_analytics/frontend/components/Accounts/AccountsViewSelector.tsx@@ -65,11 +65,17 @@ export function AccountsViewSelector(): JSX.Element {return (<div className="flex items-center gap-2">- {currentView ? (+ {views.length > 0 ? (<LemonMenu items={menuItems} closeOnClickInside><LemonButton type="secondary" size="small" sideIcon={<IconChevronDown />}>- <ViewVisibilityIcon view={currentView} />- <span className="ml-2">{currentView.name}</span>+ {currentView ? (+ <>+ <ViewVisibilityIcon view={currentView} />+ <span className="ml-2">{currentView.name}</span>+ </>+ ) : (+ 'Select view'+ )}</LemonButton></LemonMenu>) : (