Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
];

let account: OnyxEntry<Account>;
Onyx.connect({

Check warning on line 47 in src/libs/Navigation/Navigation.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.ACCOUNT,
callback: (value) => {
account = value;
Expand Down Expand Up @@ -160,15 +160,6 @@
return '';
}

/**
* Cleans the route path by removing redundant slashes and query parameters.
* @param routePath The route path to clean.
* @returns The cleaned route path.
*/
function cleanRoutePath(routePath: string): string {
return routePath.replace(CONST.REGEX.ROUTES.REDUNDANT_SLASHES, (match, p1) => (p1 ? '/' : '')).replace(/\?.*/, '');
}

/**
* Check whether the passed route is currently Active or not.
*
Expand All @@ -179,11 +170,11 @@
* @return is active
*/
function isActiveRoute(routePath: Route): boolean {
let activeRoute = getActiveRouteWithoutParams();
let activeRoute = getActiveRoute();
activeRoute = activeRoute.startsWith('/') ? activeRoute.substring(1) : activeRoute;

// We remove redundant (consecutive and trailing) slashes from path before matching
return cleanRoutePath(activeRoute) === cleanRoutePath(routePath);
return activeRoute === routePath.replace(CONST.REGEX.ROUTES.REDUNDANT_SLASHES, (match, p1) => (p1 ? '/' : ''));
}

/**
Expand Down
75 changes: 0 additions & 75 deletions tests/navigation/isActiveRouteTests.tsx

This file was deleted.

Loading