From 344212c0a773f29e70ff42a54c7b629af25d29c1 Mon Sep 17 00:00:00 2001 From: Vikram Raj Date: Fri, 5 Dec 2025 20:38:27 +0530 Subject: [PATCH] Prevent application filter in Topology view from resetting to all applications unexpectedly --- frontend/public/components/namespace-bar.tsx | 8 +++++++- frontend/public/reducers/ui.ts | 4 +--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/public/components/namespace-bar.tsx b/frontend/public/components/namespace-bar.tsx index 4cab6018a1d..d83a71c47bc 100644 --- a/frontend/public/components/namespace-bar.tsx +++ b/frontend/public/components/namespace-bar.tsx @@ -5,7 +5,11 @@ import { useDispatch, useSelector } from 'react-redux'; import { NamespaceBarProps, useActivePerspective } from '@console/dynamic-plugin-sdk'; import { ALL_NAMESPACES_KEY } from '@console/dynamic-plugin-sdk/src/constants'; -import { FLAGS, KEYBOARD_SHORTCUTS } from '@console/shared/src/constants/common'; +import { + ALL_APPLICATIONS_KEY, + FLAGS, + KEYBOARD_SHORTCUTS, +} from '@console/shared/src/constants/common'; import { NamespaceDropdown } from '@console/shared/src/components/namespace/NamespaceDropdown'; import { useActiveNamespace } from '@console/shared/src/hooks/useActiveNamespace'; import { useFlag } from '@console/dynamic-plugin-sdk/src/utils/flags'; @@ -18,6 +22,7 @@ import { FirehoseResult } from './utils/types'; import { removeQueryArgument } from './utils/router'; import { useCreateNamespaceOrProjectModal } from '@console/shared/src/hooks/useCreateNamespaceOrProjectModal'; import type { RootState } from '../redux'; +import { setActiveApplication } from '../actions/ui'; export type NamespaceBarDropdownsProps = { children: React.ReactNode; @@ -77,6 +82,7 @@ export const NamespaceBarDropdowns: React.FC = ({ onNamespaceChange?.(newNamespace); setActiveNamespace(newNamespace); removeQueryArgument('project-name'); + activeNamespace !== newNamespace && dispatch(setActiveApplication(ALL_APPLICATIONS_KEY)); }} onCreateNew={() => { createNamespaceOrProjectModal({ diff --git a/frontend/public/reducers/ui.ts b/frontend/public/reducers/ui.ts index 7bcd87c5ace..475cba2f85c 100644 --- a/frontend/public/reducers/ui.ts +++ b/frontend/public/reducers/ui.ts @@ -63,9 +63,7 @@ export default (state: UIState, action: UIAction): UIState => { return state; } - return state - .set('activeApplication', ALL_APPLICATIONS_KEY) - .set('activeNamespace', action.payload.namespace); + return state.set('activeNamespace', action.payload.namespace); case ActionType.SetCurrentLocation: { state = state.set('location', action.payload.location);