: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(persons): stop pagination controls staying active with no rows (#72045)
Gustavo H. Strassburgerce9f15a620fd
diff --git a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.ts b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.tsindex 982f72ecf201..ba6410b14d42 100644--- a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.ts+++ b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.ts@@ -231,6 +231,9 @@ describe('relatedFeatureFlagsLogic', () => {it('sets loadError on a failed load and clears it once a retry succeeds', async () => {await expectLogic(logic).toFinishAllListeners()expect(logic.values.loadError).toBe(true)+ // No pagination controls next to the error state — the flags list count would+ // otherwise keep the arrows active over an empty table+ expect(logic.values.pagination).toBeUndefined()useMocks({get: {@@ -242,8 +245,14 @@ describe('relatedFeatureFlagsLogic', () => {await expectLogic(logic, () => {logic.actions.loadRelatedFeatureFlags()}).toFinishAllListeners()+ await expectLogic(flagsLogic).toFinishAllListeners()expect(logic.values.loadError).toBe(false)+ // Server-controlled paging over the full flags list must come back after a retry —+ // this table pages through featureFlagsLogic, not through its own rows+ expect(logic.values.pagination).toEqual(+ expect.objectContaining({ controlled: true, entryCount: MOCK_FLAGS.length })+ )})})})diff --git a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.ts b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.tsindex f400287ed2fc..ae734ab58cbf 100644--- a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.ts+++ b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.ts@@ -41,13 +41,13 @@ export interface RelatedFlagsFilters {export interface relatedFeatureFlagsLogicValues {featureFlags: FeatureFlagsResult // featureFlagsLogicfeatureFlagsLoading: boolean // featureFlagsLogic- pagination: PaginationManual // featureFlagsLogiccurrentProjectId: number | null // projectLogicfilteredMappedFlags: RelatedFeatureFlag[]filters: Partial<RelatedFlagsFilters>isLoading: booleanloadError: booleanmappedRelatedFeatureFlags: RelatedFeatureFlag[]+ pagination: PaginationManual | undefinedrelatedFeatureFlags: RelatedFeatureFlagResponse | nullrelatedFeatureFlagsLoading: booleansearchTerm: string@@ -118,6 +118,7 @@ export interface relatedFeatureFlagsLogicMeta {mappedRelatedFeatureFlags: RelatedFeatureFlag[],filters: Partial<RelatedFlagsFilters>) => RelatedFeatureFlag[]+ pagination: (pagination: PaginationManual, loadError: boolean) => PaginationManual | undefined}}@@ -139,12 +140,7 @@ export const relatedFeatureFlagsLogic = kea<relatedFeatureFlagsLogicType>([),key((props) => `${props.distinctId}`),connect(() => ({- values: [- projectLogic,- ['currentProjectId'],- featureFlagsLogic,- ['featureFlags', 'pagination', 'featureFlagsLoading'],- ],+ values: [projectLogic, ['currentProjectId'], featureFlagsLogic, ['featureFlags', 'featureFlagsLoading']],actions: [featureFlagsLogic, ['setFeatureFlagsFilters', 'loadFeatureFlags']],})),actions({@@ -254,6 +250,15 @@ export const relatedFeatureFlagsLogic = kea<relatedFeatureFlagsLogicType>([return filteredFlags},],+ // The flags list is server-paginated (100 per page) and this table pages through it via+ // the `page` URL param (see urlToAction below), so it reuses featureFlagsLogic's+ // controlled pagination. Suppress it while the evaluation_reasons load has failed —+ // otherwise the controls advertise the full flags count next to an empty error state.+ pagination: [+ () => [featureFlagsLogic.selectors.pagination, selectors.loadError],+ (pagination: PaginationManual, loadError: boolean): PaginationManual | undefined =>+ loadError ? undefined : pagination,+ ],})),listeners(({ values, actions }) => ({setFilters: ({ filters, replace }) => {