: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): improve feature request filters (#88058)
Arthur Moreira de Deus8734529a18b2
diff --git a/frontend/src/lib/components/MemberSelectRow.test.tsx b/frontend/src/lib/components/MemberSelectRow.test.tsxindex 32b434cef376..1923c2f06619 100644--- a/frontend/src/lib/components/MemberSelectRow.test.tsx+++ b/frontend/src/lib/components/MemberSelectRow.test.tsx@@ -53,11 +53,13 @@ describe('MemberSelectRow', () => {const checkbox = container.querySelector('input[type="checkbox"]') as HTMLInputElement | nullexpect(checkbox).not.toBeNull()expect(checkbox!.checked).toBe(checked)+ expect(checkbox).toHaveAttribute('tabindex', '-1')+ expect(checkbox).toHaveAttribute('aria-hidden', 'true')})- it('fires onClick when the row is clicked', () => {+ it('fires onClick when the name in a multi-select row is clicked', () => {const onClick = jest.fn()- renderRow({ onClick })+ renderRow({ checked: false, onClick })fireEvent.click(screen.getByText(fullName(member.user)))expect(onClick).toHaveBeenCalledTimes(1)})diff --git a/frontend/src/lib/components/MemberSelectRow.tsx b/frontend/src/lib/components/MemberSelectRow.tsxindex dde3502a734c..e571cc85f0f8 100644--- a/frontend/src/lib/components/MemberSelectRow.tsx+++ b/frontend/src/lib/components/MemberSelectRow.tsx@@ -1,4 +1,4 @@-import { LemonButton, ProfilePicture } from '@posthog/lemon-ui'+import { LemonButton, LemonCheckbox, ProfilePicture } from '@posthog/lemon-ui'import { fullName } from 'lib/utils/strings'@@ -21,21 +21,18 @@ export function MemberSelectRow({ member, isYou, onClick, checked }: MemberSelecrole={isMultiSelect ? 'menuitemcheckbox' : 'menuitem'}aria-checked={checked}size="small"- icon={<ProfilePicture size="md" user={member.user} />}+ icon={+ isMultiSelect ? (+ <LemonCheckbox checked={checked} className="pointer-events-none" decorative />+ ) : (+ <ProfilePicture size="md" user={member.user} />+ )+ }onClick={onClick}><span className="flex items-center justify-between gap-2 flex-1"><span className="flex items-center gap-2 max-w-full">- {isMultiSelect && (- <input- type="checkbox"- className="cursor-pointer"- checked={checked}- readOnly- tabIndex={-1}- aria-hidden- />- )}+ {isMultiSelect && <ProfilePicture size="md" user={member.user} />}<span>{fullName(member.user)}</span></span><span className="text-secondary">{isYou ? '(you)' : ''}</span>diff --git a/frontend/src/lib/lemon-ui/LemonCheckbox/LemonCheckbox.tsx b/frontend/src/lib/lemon-ui/LemonCheckbox/LemonCheckbox.tsxindex 316bb0a991b1..5e6995b84037 100644--- a/frontend/src/lib/lemon-ui/LemonCheckbox/LemonCheckbox.tsx+++ b/frontend/src/lib/lemon-ui/LemonCheckbox/LemonCheckbox.tsx@@ -29,6 +29,8 @@ export interface LemonCheckboxProps {'data-attr'?: string/** Whether to stop propagation of events from the input */stopPropagation?: boolean+ /** Removes input semantics when an ancestor owns the interaction. */+ decorative?: boolean}export interface BoxCSSProperties extends React.CSSProperties {@@ -59,6 +61,7 @@ export function LemonCheckbox({size,'data-attr': dataAttr,stopPropagation,+ decorative,}: LemonCheckboxProps): JSX.Element {const indeterminate = checked === 'indeterminate'disabled = disabled || !!disabledReason@@ -119,6 +122,8 @@ export function LemonCheckbox({}}id={id}disabled={disabled}+ tabIndex={decorative ? -1 : undefined}+ aria-hidden={decorative || undefined}/><labelhtmlFor={id}diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.mdindex b1012dc4a9c3..59bd245084d9 100644--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md@@ -50,7 +50,7 @@ AccountsTabContent ── binds dataNodeLogic(ACCOUNTS_TABLE_DATA_NODE_KEY, acc| `accountNotebooksLogic` | Notes/notebooks linked to one account (keyed by `accountId`): server-side pagination (`page`/`notebooksCount`), debounced title+content search (`searchTerm`), sort (`sorting` by created date/author), and `createNote` (creates an internal account notebook and opens it in the side panel). || `accountRelatedUsersLogic` | Group members / related users for one account (keyed by `externalId`). US-region orgs come from the org-members endpoint; when it returns no members, the logic falls back to the `eu_org_members` data warehouse view (a materialized pre-join of the EU postgres sync, prod-only, refreshed daily), fetched once per expansion and paginated client-side. A missing view (local dev) degrades to the normal empty state. || `accountRelationshipsLogic` | Relationship assignments for one account (keyed by `accountId`): fetches the full timeline once (`include_history=true` on the nested relationships endpoint) — the `displayedRelationships` selector (current assignments first, newest first, optionally narrowed by `definitionFilter`) feeds the (paginated) history tab, the `activeRelationships` selector feeds the sidebar summary. Also owns the tab's mutations: `assignRelationship` (definition picker + `MemberSelect`, POSTs the assign endpoint) and `endRelationship` (per active row, POSTs the end endpoint) — both guarded by a shared `relationshipSaving` flag, reload the timeline, and force-refresh the list's data nodes so relationship columns stay in sync. |-| `accountFeatureRequestsLogic` | Feature requests for one account (keyed by `accountId`): loads linked requests with server pagination and debounced search, then searches a bounded server page of accessible, editable active requests for the link picker. Request links carry the account's Feature requests deep link as their origin, so the detail breadcrumb returns to the same account tab. The picker exposes load failures with retry guidance and refreshes stale options after optimistic-concurrency conflicts. |+| `accountFeatureRequestsLogic` | Feature requests for one account (keyed by `accountId`): loads linked requests in server pages of five with debounced search, then searches a bounded server page of accessible, editable active requests for the link picker. Request links carry the account's Feature requests deep link as their origin, so the detail breadcrumb returns to the same account tab. The picker exposes load failures with retry guidance and refreshes stale options after optimistic-concurrency conflicts. || `accountBillingLogic` | Billing data behind the Usage and Spend tabs (keyed by `accountId:kind`); injects the account's org + date range into saved billing insights' SQL variables, preloads each insight result when the account expands, and owns the per-view hidden-series state (`ephemeralHiddenSeriesKeysByShortId`) behind the chart chips. || `accountOpportunitiesLogic` | Salesforce opportunities behind the Opportunities tab (keyed by `accountId`): fetches the account's `sfdc_id`, then queries the data-warehouse `salesforce.opportunity` table via HogQL. Degrades to an empty state (not an error) when the table is absent — it's production-only. || `accountSummariesLogic` | The Summaries tab (keyed by `accountId`): fetches the account (for its linked `slack_channel_id` and `slack_summary_cadence`) plus the first page of the `accountsSummariesList` endpoint, navigates server pages via `loadSummariesPage` (5 per page, `page` reducer; each page replaces the last), holds per-summary collapse state (`expandedSummaryIds` / `toggleSummaryExpanded`), and owns the cadence opt-in (`setCadence` PATCHes the account through `accountsPartialUpdate`, guarded by a `cadenceSaving` flag). Turning the cadence on with no summaries yet starts `generatingFirstSummary` polling (`startFirstSummaryPolling` / `stopFirstSummaryPolling`, two `cache.disposables` keys) so the backfill the backend kicks off appears without a refresh; the poll deadline lives in a module-level map keyed by account id, because this logic unmounts whenever its row collapses while the backfill keeps running. Distinguishes not-loaded / no-channel-linked / generating / loaded-empty / load-failed; captures unexpected failures. |diff --git a/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.test.tsindex 14c21747113a..5d2246f91489 100644--- a/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.test.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.test.ts@@ -8,7 +8,7 @@ import { initKeaTests } from '~/test/init'import * as generatedApi from '../../generated/api'import type { FeatureRequestApi, PaginatedFeatureRequestListApi } from '../../generated/api.schemas'-import { accountFeatureRequestsLogic } from './accountFeatureRequestsLogic'+import { ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE, accountFeatureRequestsLogic } from './accountFeatureRequestsLogic'const existingRequest: FeatureRequestApi = {id: 'request-1',@@ -79,14 +79,14 @@ describe('accountFeatureRequestsLogic', () => {})it('paginates linked requests and searches from the first page', async () => {- const requests = Array.from({ length: 21 }, (_, index) => ({+ const requests = Array.from({ length: ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE + 1 }, (_, index) => ({...existingRequest,id: `request-${index + 1}`,title: `Request ${index + 1}`,}))const listSpy = jest.spyOn(generatedApi, 'featureRequestsList').mockImplementation(async (_teamId, params) => {const offset = params?.offset ?? 0- const limit = params?.limit ?? 20+ const limit = params?.limit ?? ACCOUNT_FEATURE_REQUESTS_PAGE_SIZEreturn {count: requests.length,next: offset + limit < requests.length ? 'next' : null,@@ -98,14 +98,18 @@ describe('accountFeatureRequestsLogic', () => {logic.mount()await expectLogic(logic).toFinishAllListeners()- expect(logic.values.accountRequests.results).toHaveLength(20)+ expect(logic.values.accountRequests.results).toHaveLength(ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE)await expectLogic(logic, () => logic.actions.setAccountRequestsPage(2)).toFinishAllListeners()expect(logic.values.accountRequests.results).toHaveLength(1)expect(listSpy).toHaveBeenCalledWith(String(MOCK_DEFAULT_TEAM.id),- expect.objectContaining({ account_ids: ['account-2'], limit: 20, offset: 20 })+ expect.objectContaining({+ account_ids: ['account-2'],+ limit: ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE,+ offset: ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE,+ }))await expectLogic(logic, () => logic.actions.setAccountRequestsSearch('scheduled')).toFinishAllListeners()@@ -115,7 +119,7 @@ describe('accountFeatureRequestsLogic', () => {String(MOCK_DEFAULT_TEAM.id),expect.objectContaining({account_ids: ['account-2'],- limit: 20,+ limit: ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE,offset: 0,search: 'scheduled',})@@ -135,10 +139,10 @@ describe('accountFeatureRequestsLogic', () => {jest.spyOn(generatedApi, 'featureRequestsList').mockResolvedValueOnce(emptyPage).mockImplementation(async (_teamId, params) => {- if (params?.offset === 20) {+ if (params?.offset === ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE) {return pageTwoResponse}- if (params?.offset === 40) {+ if (params?.offset === ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE * 2) {return pageThreeResponse}return emptyPage@@ -149,8 +153,9 @@ describe('accountFeatureRequestsLogic', () => {logic.actions.setAccountRequestsPage(2)logic.actions.setAccountRequestsPage(3)- resolvePageThree({ ...emptyPage, count: 41, results: [{ ...existingRequest, id: 'request-page-3' }] })- resolvePageTwo({ ...emptyPage, count: 41, results: [{ ...existingRequest, id: 'request-page-2' }] })+ const requestCount = ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE * 2 + 1+ resolvePageThree({ ...emptyPage, count: requestCount, results: [{ ...existingRequest, id: 'request-page-3' }] })+ resolvePageTwo({ ...emptyPage, count: requestCount, results: [{ ...existingRequest, id: 'request-page-2' }] })await expectLogic(logic).toFinishAllListeners()expect(logic.values.accountRequestsPage).toBe(3)diff --git a/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.tsindex 209b9a017d62..c02ebfa8c7db 100644--- a/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountFeatureRequestsLogic.ts@@ -9,7 +9,7 @@ import type { TeamPublicType, TeamType } from '../../../../../frontend/src/typesimport { featureRequestsList, featureRequestsUpdate } from '../../generated/api'import type { FeatureRequestApi, PaginatedFeatureRequestListApi } from '../../generated/api.schemas'-export const ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE = 20+export const ACCOUNT_FEATURE_REQUESTS_PAGE_SIZE = 5const AVAILABLE_REQUESTS_LIMIT = 50const EMPTY_REQUESTS_RESPONSE: PaginatedFeatureRequestListApi = {count: 0,diff --git a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsx b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsxindex e626af646ba0..b4130f5fdbdf 100644--- a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsx+++ b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsx@@ -31,6 +31,7 @@ import { FeatureRequestStatusBadge } from './FeatureRequestStatusBadge'export function FeatureRequestDetail({ request }: { request: FeatureRequestApi }): JSX.Element {const {mutatingArchive,+ featureRequestBackLabel,featureRequestBackUrl,activeRequestAccountLinks,activeRequestEvidenceCount,@@ -67,8 +68,10 @@ export function FeatureRequestDetail({ request }: { request: FeatureRequestApi }icon={<IconArrowLeft />}to={featureRequestBackUrl}className="-ml-2"+ aria-label={featureRequestBackLabel ?? 'Back'}+ tooltip={featureRequestBackLabel ? undefined : 'Back'}>- Feature requests+ {featureRequestBackLabel}</LemonButton><div className="flex items-center gap-2">{!request.is_archived && (diff --git a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestFilters.tsx b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestFilters.tsxindex 6cb6320708d3..bf421f37d0e0 100644--- a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestFilters.tsx+++ b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestFilters.tsx@@ -10,7 +10,7 @@ import {IconSort,IconTarget,} from '@posthog/icons'-import { LemonButton, LemonMenu, LemonMenuItems } from '@posthog/lemon-ui'+import { LemonButton, LemonDropdown, LemonInputSelect, LemonMenu, LemonMenuItems } from '@posthog/lemon-ui'import { MemberSelectMultiplePopover } from 'lib/components/MemberSelectMultiplePopover'@@ -32,15 +32,17 @@ export function FeatureRequestFilters(): JSX.Element {archiveState,requestOrdering,productAreas,- accounts,+ accountOptions,+ accountsLoading,featureRequestsResponseLoading,hasActiveFilters,} = useValues(featureRequestsLogic)const {toggleStatusFilter,togglePriorityFilter,- toggleProductAreaFilter,- toggleAccountFilter,+ setProductAreaFilter,+ setAccountFilter,+ setAccountSearch,setCreatedByFilter,setArchiveState,setRequestOrdering,@@ -66,24 +68,10 @@ export function FeatureRequestFilters(): JSX.Element {})),},]- const productAreaItems: LemonMenuItems = [- {- items: productAreas.map((area) => ({- label: area.is_active ? area.name : `${area.name} (inactive)`,- active: productAreaFilter.includes(area.id),- onClick: () => toggleProductAreaFilter(area.id),- })),- },- ]- const accountItems: LemonMenuItems = [- {- items: accounts.map((account) => ({- label: account.name,- active: accountFilter.includes(account.id),- onClick: () => toggleAccountFilter(account.id),- })),- },- ]+ const productAreaOptions = productAreas.map((area) => ({+ key: area.id,+ label: area.is_active ? area.name : `${area.name} (inactive)`,+ }))const archiveItems: LemonMenuItems = [{items: FEATURE_REQUEST_ARCHIVE_OPTIONS.map((option) => ({@@ -133,7 +121,21 @@ export function FeatureRequestFilters(): JSX.Element {{priorityFilter.length ? `Priority · ${priorityFilter.length}` : 'Priority'}</LemonButton></LemonMenu>- <LemonMenu items={productAreaItems} closeOnClickInside={false}>+ <LemonDropdown+ closeOnClickInside={false}+ overlay={+ <div className="p-2 min-w-64">+ <LemonInputSelect+ mode="multiple"+ value={productAreaFilter}+ options={productAreaOptions}+ onChange={setProductAreaFilter}+ placeholder="Search product areas..."+ data-attr="feature-requests-product-area-filter"+ />+ </div>+ }+ ><LemonButtontype="secondary"size="small"@@ -143,8 +145,24 @@ export function FeatureRequestFilters(): JSX.Element {>{productAreaFilter.length ? `Product area · ${productAreaFilter.length}` : 'Product area'}</LemonButton>- </LemonMenu>- <LemonMenu items={accountItems} closeOnClickInside={false}>+ </LemonDropdown>+ <LemonDropdown+ closeOnClickInside={false}+ overlay={+ <div className="p-2 min-w-64">+ <LemonInputSelect+ mode="multiple"+ value={accountFilter}+ options={accountOptions}+ onChange={setAccountFilter}+ onInputChange={setAccountSearch}+ loading={accountsLoading}+ placeholder="Search accounts..."+ data-attr="feature-requests-account-filter"+ />+ </div>+ }+ ><LemonButtontype="secondary"size="small"@@ -154,7 +172,7 @@ export function FeatureRequestFilters(): JSX.Element {>{accountFilter.length ? `Account · ${accountFilter.length}` : 'Account'}</LemonButton>- </LemonMenu>+ </LemonDropdown><MemberSelectMultiplePopover value={createdByFilter} onChange={setCreatedByFilter} /><LemonMenu items={archiveItems} closeOnClickInside><LemonButtondiff --git a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.test.ts b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.test.tsindex 78933a6b8c38..289380abec85 100644--- a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.test.ts+++ b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.test.ts@@ -1,6 +1,10 @@import { urls } from 'scenes/urls'-import { getFeatureRequestBackUrl, getFeatureRequestDetailUrl } from './featureRequestNavigation'+import {+ getFeatureRequestBackLabel,+ getFeatureRequestBackUrl,+ getFeatureRequestDetailUrl,+} from './featureRequestNavigation'describe('feature request navigation', () => {it('links an account request back to its feature requests tab', () => {@@ -23,6 +27,7 @@ describe('feature request navigation', () => {const origin = `${urls.customerAnalyticsAccount('account-1', 'feature_requests')}?tab=details`expect(getFeatureRequestBackUrl(origin, { status: 'planned' })).toBe(origin)+ expect(getFeatureRequestBackLabel(origin)).toBeNull()})it.each([undefined, 'https://example.com/accounts', '//example.com/accounts', '/\\example.com/accounts'])(@@ -31,6 +36,7 @@ describe('feature request navigation', () => {expect(getFeatureRequestBackUrl(origin, { status: 'planned' })).toBe(`${urls.customerAnalyticsFeatureRequests()}?status=planned`)+ expect(getFeatureRequestBackLabel(origin)).toBe('Feature requests')})})diff --git a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.ts b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.tsindex 1a50aa7f6e6e..3b161189ffcd 100644--- a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.ts+++ b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestNavigation.ts@@ -33,3 +33,7 @@ function isInternalOrigin(origin: unknown): origin is string {export function getFeatureRequestBackUrl(origin: unknown, listSearchParams: Record<string, string>): string {return isInternalOrigin(origin) ? origin : combineUrl(urls.customerAnalyticsFeatureRequests(), listSearchParams).url}++export function getFeatureRequestBackLabel(origin: unknown): string | null {+ return isInternalOrigin(origin) ? null : 'Feature requests'+}diff --git a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.ts b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.tsindex 8eb9c8570407..c920e3a7f601 100644--- a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.ts+++ b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.ts@@ -154,13 +154,16 @@ describe('featureRequestsLogic', () => {expect(logic.values.evidenceRequestedOn).toBeNull()})- it('keeps the selected account name and external key while search results reload', () => {- logic.actions.loadAccountsSuccess([account])+ it('keeps selected account options while search results reload', () => {+ const filterAccount = { ...account, id: 'account-2', name: 'Globex', external_id: 'cust_globex_001' }+ logic.actions.loadAccountsSuccess([account, filterAccount])logic.actions.setAccountId(account.id)+ logic.actions.setAccountFilter([filterAccount.id])logic.actions.loadAccountsSuccess([])expect(logic.values.accountOptions).toEqual([- { key: account.id, label: `${account.name} (${account.external_id})` },+ { key: filterAccount.id, label: filterAccount.name },+ { key: account.id, label: account.name },])})@@ -240,6 +243,29 @@ describe('featureRequestsLogic', () => {expect(logic.values.productAreaFormOpen).toBe(false)})+ it('applies the created-by filter on the first change', async () => {+ router.actions.push(urls.customerAnalyticsFeatureRequests())+ await expectLogic(logic).toFinishAllListeners()+ const listSpy = jest.spyOn(generatedApi, 'featureRequestsList').mockResolvedValue({+ count: 1,+ next: null,+ previous: null,+ results: [createdRequest],+ })++ logic.actions.setCreatedByFilter([1])+ expect(logic.values.createdByFilter).toEqual([1])+ expect(parseFeatureRequestSearchParams(router.values.searchParams).createdByFilter).toEqual([1])+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.createdByFilter).toEqual([1])+ expect(parseFeatureRequestSearchParams(router.values.searchParams).createdByFilter).toEqual([1])+ expect(listSpy).toHaveBeenLastCalledWith(+ String(MOCK_DEFAULT_TEAM.id),+ expect.objectContaining({ created_by_ids: [1] })+ )+ })+it('loads the requested page with 20 requests per page', async () => {await expectLogic(logic).toFinishAllListeners()const listSpy = jest.spyOn(generatedApi, 'featureRequestsList').mockResolvedValue({@@ -471,9 +497,7 @@ describe('featureRequestsLogic', () => {logic.actions.setAddAccountId(otherAccount.id)logic.actions.setEvidenceSummary('Globex needs a weekly export.')logic.actions.setEvidenceSource('meeting')- expect(logic.values.addAccountOptions).toEqual([- { key: otherAccount.id, label: `${otherAccount.name} (${otherAccount.external_id})` },- ])+ expect(logic.values.addAccountOptions).toEqual([{ key: otherAccount.id, label: otherAccount.name }])await expectLogic(logic, () => logic.actions.saveEvidence()).toFinishAllListeners()diff --git a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.ts b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.tsindex 93819a3ce52c..24ca32c610c6 100644--- a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.ts+++ b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.ts@@ -41,7 +41,7 @@ import type {PaginatedFeatureRequestListApi,RequestPriorityEnumApi,} from '../../generated/api.schemas'-import { getFeatureRequestBackUrl } from './featureRequestNavigation'+import { getFeatureRequestBackLabel, getFeatureRequestBackUrl } from './featureRequestNavigation'import {FEATURE_REQUEST_ORDERING_OPTIONS,FEATURE_REQUEST_PRIORITY_FILTER_OPTIONS,@@ -118,9 +118,8 @@ function parseListParam(raw: unknown, valid?: Set<string>): string[] {}function parsePositiveIntegerListParam(raw: unknown): number[] {- return parseListParam(raw)- .map(Number)- .filter((value) => Number.isInteger(value) && value > 0)+ const values = typeof raw === 'number' ? [raw] : parseListParam(raw).map(Number)+ return values.filter((value) => Number.isInteger(value) && value > 0)}export function parseFeatureRequestSearchParams(searchParams: Record<string, any>): FeatureRequestListState {@@ -262,6 +261,7 @@ export interface featureRequestsLogicValues {evidenceSource: stringevidenceSummary: stringevidenceUrl: string+ featureRequestBackLabel: string | nullfeatureRequestBackUrl: stringfeatureRequestsError: string | nullfeatureRequestsPage: number@@ -271,6 +271,7 @@ export interface featureRequestsLogicValues {hasActiveFilters: booleanidempotencyKey: stringlistSearchParams: Record<string, string>+ loadedAccountsById: Record<string, AccountApi>mutatingArchive: booleanpriorityFilter: FeatureRequestPriorityFilter[]productAreaActive: boolean@@ -459,6 +460,9 @@ export interface featureRequestsLogicActions {saveRequestChanges: () => {value: true}+ setAccountFilter: (accountFilter: string[]) => {+ accountFilter: string[]+ }setAccountId: (accountId: string | null) => {accountId: string | null}@@ -546,6 +550,9 @@ export interface featureRequestsLogicActions {setProductAreaDisplayOrder: (productAreaDisplayOrder: number) => {productAreaDisplayOrder: number}+ setProductAreaFilter: (productAreaFilter: string[]) => {+ productAreaFilter: string[]+ }setProductAreaIds: (productAreaIds: string[]) => {productAreaIds: string[]}@@ -604,15 +611,9 @@ export interface featureRequestsLogicActions {submitRequest: () => {value: true}- toggleAccountFilter: (accountId: string) => {- accountId: string- }togglePriorityFilter: (requestPriority: FeatureRequestPriorityFilter) => {requestPriority: FeatureRequestPriorityFilter}- toggleProductAreaFilter: (productAreaId: string) => {- productAreaId: string- }toggleStatusFilter: (requestStatus: FeatureRequestStatusEnumApi) => {requestStatus: FeatureRequestStatusEnumApi}@@ -633,6 +634,8 @@ export interface featureRequestsLogicMeta {) => FeatureRequestProductAreaApi[]accountOptions: (accounts: AccountApi[],+ loadedAccountsById: Record<string, AccountApi>,+ accountFilter: string[],selectedAccount: FeatureRequestAccountApi | null,activeRequest: FeatureRequestApi | null) => {@@ -714,6 +717,7 @@ export interface featureRequestsLogicMeta {requestOrdering: FeatureRequestOrdering,featureRequestsPage: number) => Record<string, string>+ featureRequestBackLabel: (searchParams: Record<string, any>) => string | nullfeatureRequestBackUrl: (listSearchParams: Record<string, string>, searchParams: Record<string, any>) => string}}@@ -738,8 +742,8 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([setSearchQuery: (searchQuery: string) => ({ searchQuery }),toggleStatusFilter: (requestStatus: FeatureRequestStatusEnumApi) => ({ requestStatus }),togglePriorityFilter: (requestPriority: FeatureRequestPriorityFilter) => ({ requestPriority }),- toggleProductAreaFilter: (productAreaId: string) => ({ productAreaId }),- toggleAccountFilter: (accountId: string) => ({ accountId }),+ setProductAreaFilter: (productAreaFilter: string[]) => ({ productAreaFilter }),+ setAccountFilter: (accountFilter: string[]) => ({ accountFilter }),setCreatedByFilter: (createdByFilter: number[]) => ({ createdByFilter }),setArchiveState: (archiveState: FeatureRequestArchiveState) => ({ archiveState }),setRequestOrdering: (requestOrdering: FeatureRequestOrdering) => ({ requestOrdering }),@@ -874,8 +878,8 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([setSearchQuery: () => 1,toggleStatusFilter: () => 1,togglePriorityFilter: () => 1,- toggleProductAreaFilter: () => 1,- toggleAccountFilter: () => 1,+ setProductAreaFilter: () => 1,+ setAccountFilter: () => 1,setCreatedByFilter: () => 1,setArchiveState: () => 1,setRequestOrdering: () => 1,@@ -909,7 +913,7 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([productAreaFilter: [[] as string[],{- toggleProductAreaFilter: (state, { productAreaId }) => toggleValue(state, productAreaId),+ setProductAreaFilter: (_, { productAreaFilter }) => productAreaFilter,setFiltersFromUrl: (_, { filters }) => filters.productAreaFilter,clearFilters: () => [],},@@ -917,11 +921,20 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([accountFilter: [[] as string[],{- toggleAccountFilter: (state, { accountId }) => toggleValue(state, accountId),+ setAccountFilter: (_, { accountFilter }) => accountFilter,setFiltersFromUrl: (_, { filters }) => filters.accountFilter,clearFilters: () => [],},],+ loadedAccountsById: [+ {} as Record<string, AccountApi>,+ {+ loadAccountsSuccess: (state, { accounts }) => ({+ ...state,+ ...Object.fromEntries(accounts.map((account) => [account.id, account])),+ }),+ },+ ],createdByFilter: [[] as number[],{@@ -1358,15 +1371,29 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([},],accountOptions: [- (selectors) => [selectors.accounts, selectors.selectedAccount, selectors.activeRequest],+ (selectors) => [+ selectors.accounts,+ selectors.loadedAccountsById,+ selectors.accountFilter,+ selectors.selectedAccount,+ selectors.activeRequest,+ ],(accounts: AccountApi[],+ loadedAccountsById: Record<string, AccountApi>,+ accountFilter: string[],selectedAccount: FeatureRequestAccountApi | null,activeRequest: FeatureRequestApi | null): { key: string; label: string }[] => {const accountById = new Map<string, AccountApi | FeatureRequestAccountApi>(accounts.map((account) => [account.id, account]))+ for (const accountId of accountFilter) {+ const selectedFilterAccount = loadedAccountsById[accountId]+ if (selectedFilterAccount && !accountById.has(accountId)) {+ accountById.set(accountId, selectedFilterAccount)+ }+ }if (selectedAccount && !accountById.has(selectedAccount.id)) {accountById.set(selectedAccount.id, selectedAccount)}@@ -1377,10 +1404,7 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([}return [...accountById.values()].map((account) => ({key: account.id,- label:- 'external_id' in account && account.external_id- ? `${account.name} (${account.external_id})`- : account.name,+ label: account.name,}))},],@@ -1634,6 +1658,10 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([featureRequestsPage,}),],+ featureRequestBackLabel: [+ () => [router.selectors.searchParams],+ (searchParams: Record<string, any>): string | null => getFeatureRequestBackLabel(searchParams.origin),+ ],featureRequestBackUrl: [(selectors) => [selectors.listSearchParams, router.selectors.searchParams],(listSearchParams: Record<string, string>, searchParams: Record<string, any>): string =>@@ -1649,8 +1677,8 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([},toggleStatusFilter: () => actions.loadFeatureRequests(),togglePriorityFilter: () => actions.loadFeatureRequests(),- toggleProductAreaFilter: () => actions.loadFeatureRequests(),- toggleAccountFilter: () => actions.loadFeatureRequests(),+ setProductAreaFilter: () => actions.loadFeatureRequests(),+ setAccountFilter: () => actions.loadFeatureRequests(),setCreatedByFilter: () => actions.loadFeatureRequests(),setArchiveState: () => actions.loadFeatureRequests(),setRequestOrdering: () => actions.loadFeatureRequests(),@@ -2001,8 +2029,8 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([setSearchQuery: toUrl,toggleStatusFilter: toUrl,togglePriorityFilter: toUrl,- toggleProductAreaFilter: toUrl,- toggleAccountFilter: toUrl,+ setProductAreaFilter: toUrl,+ setAccountFilter: toUrl,setCreatedByFilter: toUrl,setArchiveState: toUrl,setRequestOrdering: toUrl,