Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

chore: v2.0.0-canary.52

vholik03b182dd8ae4
diff --git a/packages/admin/package.json b/packages/admin/package.json
index 526b6e0a3..84610ef42 100644
--- a/packages/admin/package.json
+++ b/packages/admin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/admin",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/admin/src/components/layout/nav-item/nav-item.tsx b/packages/admin/src/components/layout/nav-item/nav-item.tsx
index 0f8fd5606..1b3a1e269 100644
--- a/packages/admin/src/components/layout/nav-item/nav-item.tsx
+++ b/packages/admin/src/components/layout/nav-item/nav-item.tsx
@@ -101,6 +101,13 @@ export const NavItem = ({
setOpen(getIsOpen(to, items, pathname));
}, [pathname, to, items]);
+ const isNestedActive = useCallback(
+ (nestedTo: string) => {
+ return pathname === nestedTo || pathname.startsWith(nestedTo + "/");
+ },
+ [pathname],
+ );
+
const navLinkClassNames = useCallback(
({
to,
@@ -114,16 +121,15 @@ export const NavItem = ({
isSetting?: boolean;
}) => {
if (["core", "setting"].includes(type)) {
- isActive = pathname.startsWith(to);
-
- // If a nested item's path matches, the parent should not be active
- if (isActive && !isNested && items?.length) {
- const nestedMatch = items.some((item) =>
- pathname.startsWith(item.to),
- );
- if (nestedMatch) {
- isActive = false;
- }
+ if (isNested) {
+ isActive = isNestedActive(to);
+ } else if (items?.length) {
+ // Parent is active only if pathname matches it directly
+ // and no nested item's path matches
+ const nestedMatch = items.some((item) => isNestedActive(item.to));
+ isActive = pathname.startsWith(to) && !nestedMatch;
+ } else {
+ isActive = pathname.startsWith(to);
}
}
@@ -133,7 +139,7 @@ export const NavItem = ({
[SETTING_NAV_LINK_CLASSES]: isSetting,
});
},
- [type, pathname, items],
+ [type, pathname, items, isNestedActive],
);
const isSetting = type === "setting";
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 31b6f101f..99cf8f3e9 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/cli",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/client/package.json b/packages/client/package.json
index c323f9c73..a9c67e30c 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/client",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/core-plugin/package.json b/packages/core-plugin/package.json
index 93aed6882..973e57bad 100644
--- a/packages/core-plugin/package.json
+++ b/packages/core-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/core-plugin",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/dashboard-sdk/package.json b/packages/dashboard-sdk/package.json
index 4eca6578f..69973dbe6 100644
--- a/packages/dashboard-sdk/package.json
+++ b/packages/dashboard-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-sdk",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/dashboard-shared/package.json b/packages/dashboard-shared/package.json
index 91443b0db..53d92e51c 100644
--- a/packages/dashboard-shared/package.json
+++ b/packages/dashboard-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/dashboard-shared",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/types/package.json b/packages/types/package.json
index f7d5c100a..a6da4e013 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/types",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/vendor/package.json b/packages/vendor/package.json
index 4b36ec828..dc6425aea 100644
--- a/packages/vendor/package.json
+++ b/packages/vendor/package.json
@@ -1,6 +1,6 @@
{
"name": "@mercurjs/vendor",
- "version": "2.0.0-canary.51",
+ "version": "2.0.0-canary.52",
"repository": {
"type": "git",
"url": "https://github.com/mercurjs/mercur",
diff --git a/packages/vendor/src/components/layout/nav-item/nav-item.tsx b/packages/vendor/src/components/layout/nav-item/nav-item.tsx
index 7d3ebb3bd..d873d1c35 100644
--- a/packages/vendor/src/components/layout/nav-item/nav-item.tsx
+++ b/packages/vendor/src/components/layout/nav-item/nav-item.tsx
@@ -105,6 +105,13 @@ export const NavItem = ({
setOpen(getIsOpen(to, items, pathname))
}, [pathname, to, items])
+ const isNestedActive = useCallback(
+ (nestedTo: string) => {
+ return pathname === nestedTo || pathname.startsWith(nestedTo + "/")
+ },
+ [pathname]
+ )
+
const navLinkClassNames = useCallback(
({
to,
@@ -118,16 +125,15 @@ export const NavItem = ({
isSetting?: boolean
}) => {
if (["core", "setting"].includes(type)) {
- isActive = pathname.startsWith(to)
-
- // If a nested item's path matches, the parent should not be active
- if (isActive && !isNested && items?.length) {
- const nestedMatch = items.some((item) =>
- pathname.startsWith(item.to)
- )
- if (nestedMatch) {
- isActive = false
- }
+ if (isNested) {
+ isActive = isNestedActive(to)
+ } else if (items?.length) {
+ // Parent is active only if pathname matches it directly
+ // and no nested item's path matches
+ const nestedMatch = items.some((item) => isNestedActive(item.to))
+ isActive = pathname.startsWith(to) && !nestedMatch
+ } else {
+ isActive = pathname.startsWith(to)
}
}
@@ -137,7 +143,7 @@ export const NavItem = ({
[SETTING_NAV_LINK_CLASSES]: isSetting,
})
},
- [type, pathname, items]
+ [type, pathname, items, isNestedActive]
)
const isSetting = type === "setting"
diff --git a/templates/basic/apps/admin/package.json b/templates/basic/apps/admin/package.json
index 5866e4dc9..ef937e48c 100644
--- a/templates/basic/apps/admin/package.json
+++ b/templates/basic/apps/admin/package.json
@@ -11,16 +11,16 @@
},
"dependencies": {
"@medusajs/icons": "^2.13.3",
- "@mercurjs/dashboard-sdk": "2.0.0-canary.50",
- "@mercurjs/dashboard-shared": "2.0.0-canary.50",
- "@mercurjs/admin": "2.0.0-canary.50",
+ "@mercurjs/dashboard-sdk": "2.0.0-canary.52",
+ "@mercurjs/dashboard-shared": "2.0.0-canary.52",
+ "@mercurjs/admin": "2.0.0-canary.52",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-i18next": "13.5.0",
"@tanstack/react-query": "5.64.2",
"@medusajs/ui": "4.1.1",
"react-router-dom": "6.30.3",
- "@mercurjs/client": "2.0.0-canary.50",
+ "@mercurjs/client": "2.0.0-canary.52",
"@acme/api": "*",
"@tanstack/react-table": "8.20.5",
"react-hook-form": "7.49.1",
diff --git a/templates/basic/apps/vendor/package.json b/templates/basic/apps/vendor/package.json
index 19364f07c..379bb6335 100644
--- a/templates/basic/apps/vendor/package.json
+++ b/templates/basic/apps/vendor/package.json
@@ -11,16 +11,16 @@
},
"dependencies": {
"@medusajs/icons": "^2.13.3",
- "@mercurjs/dashboard-sdk": "2.0.0-canary.50",
- "@mercurjs/dashboard-shared": "2.0.0-canary.50",
- "@mercurjs/vendor": "2.0.0-canary.50",
+ "@mercurjs/dashboard-sdk": "2.0.0-canary.52",
+ "@mercurjs/dashboard-shared": "2.0.0-canary.52",
+ "@mercurjs/vendor": "2.0.0-canary.52",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-i18next": "13.5.0",
"@tanstack/react-query": "5.64.2",
"@medusajs/ui": "4.1.1",
"react-router-dom": "6.30.3",
- "@mercurjs/client": "2.0.0-canary.50",
+ "@mercurjs/client": "2.0.0-canary.52",
"@acme/api": "*",
"@tanstack/react-table": "8.20.5",
"react-hook-form": "7.49.1",
diff --git a/templates/basic/packages/api/package.json b/templates/basic/packages/api/package.json
index 82b42f954..868509386 100644
--- a/templates/basic/packages/api/package.json
+++ b/templates/basic/packages/api/package.json
@@ -36,8 +36,8 @@
"@medusajs/admin-shared": "^2.13.3",
"@medusajs/medusa": "^2.13.3",
"@medusajs/draft-order": "2.13.3",
- "@mercurjs/core-plugin": "2.0.0-canary.50",
- "@mercurjs/types": "2.0.0-canary.50",
+ "@mercurjs/core-plugin": "2.0.0-canary.52",
+ "@mercurjs/types": "2.0.0-canary.52",
"zod": "3.25.76"
},
"devDependencies": {