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.
This commit is contained in:
Abdul Rahman
2026-04-08 20:38:22 +05:30
parent aae3f4301b
commit ff7cf245c4
@@ -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)) {