: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(insights): apply series rename immediately (#84020)
willwearing8b1b5bcf6440
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.test.ts b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.test.tsindex a877add315c6..1d1e7ed3cd27 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.test.ts+++ b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.test.ts@@ -67,12 +67,39 @@ describe('entityFilterLogic', () => {)})- it('closes modal after renaming', () => {- expectLogic(logic, () => {- logic.actions.renameFilter('Custom event name')- })- .toDispatchActions(['renameFilter', 'hideModal'])- .toMatchValues({ modalVisible: false })+ it('applies the rename and closes the modal without yielding', () => {+ logic.actions.selectFilter(logic.values.localFilters[0])+ logic.actions.showModal()++ logic.actions.renameFilter('Custom event name')++ expect(logic.values.localFilters[0].custom_name).toEqual('Custom event name')+ expect(logic.values.modalVisible).toBe(false)+ })++ it('closes the modal when no series is selected', () => {+ logic.actions.showModal()++ logic.actions.renameFilter('Custom event name')++ expect(logic.values.modalVisible).toBe(false)+ })++ it('does not rename another series when the selected series is removed', () => {+ const selectedFilter = logic.values.localFilters[0]+ const replacementFilter = {+ ...logic.values.localFilters[1],+ order: selectedFilter.order,+ uuid: 'replacement-uuid',+ }+ logic.actions.selectFilter(selectedFilter)+ logic.actions.showModal()+ logic.actions.setFilters([replacementFilter])++ logic.actions.renameFilter('Custom event name')++ expect(logic.values.localFilters[0].custom_name).not.toEqual('Custom event name')+ expect(logic.values.modalVisible).toBe(false)})})diff --git a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.tsindex b4fe8d74866f..92818f934a3e 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts+++ b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts@@ -475,20 +475,23 @@ export const entityFilterLogic = kea<entityFilterLogicType>([}),listeners(({ actions, values, props }) => ({- renameFilter: async ({ custom_name }, breakpoint) => {- if (!values.selectedFilter) {- return+ renameFilter: ({ custom_name }) => {+ const selectedFilter = values.selectedFilter as LocalFilter | null+ if (selectedFilter) {+ const index = selectedFilter.uuid+ ? values.localFilters.findIndex((filter) => filter.uuid === selectedFilter.uuid)+ : selectedFilter.order++ if (index !== -1) {+ actions.updateFilter({+ ...selectedFilter,+ index,+ custom_name,+ } as EntityFilter & {+ index: number+ })+ }}-- await breakpoint(100)-- actions.updateFilter({- ...values.selectedFilter,- index: values.selectedFilter?.order,- custom_name,- } as EntityFilter & {- index: number- })actions.hideModal()},hideModal: () => {