From ff7cf245c4a73cfeb70abf0f09441443486899ae Mon Sep 17 00:00:00 2001 From: Abdul Rahman Date: Wed, 8 Apr 2026 20:38:22 +0530 Subject: [PATCH] Refactor active state logic in NavigationDrawerItemForObjectMetadataItem - Updated the `isActive` calculation to include a check for `navItemId` when `isAtomForCurrentObject` is true, enhancing the accuracy of active navigation item detection. - This change improves the clarity and maintainability of the component's navigation logic, aligning with recent refactoring efforts. --- .../NavigationDrawerItemForObjectMetadataItem.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx index 2758919777e..fc183c01b17 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx @@ -126,10 +126,11 @@ export const NavigationDrawerItemForObjectMetadataItem = ({ objectMetadataItem.nameSingular, ); - const isActive = isAtomForCurrentObject - ? activeNavigationItem.navItemId === navItemId || - isRecordMatchingCurrentPage - : isActiveByUrl; + const isActive = + isAtomForCurrentObject && isDefined(navItemId) + ? activeNavigationItem.navItemId === navItemId || + isRecordMatchingCurrentPage + : isActiveByUrl; const handleBeforeNavigation = () => { if (isDefined(navItemId)) {