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:
+5
-4
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user