We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08df299 commit d12cb11Copy full SHA for d12cb11
resources/js/lib/utils.ts
@@ -7,7 +7,17 @@ export function cn(...inputs: ClassValue[]) {
7
}
8
9
export function urlIsActive(urlToCheck: NonNullable<InertiaLinkProps['href']>, currentUrl: string) {
10
- return toUrl(urlToCheck) === currentUrl;
+ const checkUrl = toUrl(urlToCheck);
11
+
12
+ if (checkUrl === '/' && currentUrl === '/') {
13
+ return true;
14
+ }
15
16
+ if (checkUrl !== '/' && currentUrl.startsWith(checkUrl)) {
17
18
19
20
+ return false;
21
22
23
export function toUrl(href: NonNullable<InertiaLinkProps['href']>) {
0 commit comments