@redocly/theme 0.59.0-next.6 → 0.59.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -71,7 +71,7 @@ function useNestedMenu({ item, labelRef, nestedMenuRef }) {
|
|
|
71
71
|
}
|
|
72
72
|
const [firstChild] = item.items;
|
|
73
73
|
if (!isExpanded && item.selectFirstItemOnExpand && firstChild.link) {
|
|
74
|
-
yield (0, load_and_navigate_1.loadAndNavigate)({ navigate, to: firstChild.link });
|
|
74
|
+
yield (0, load_and_navigate_1.loadAndNavigate)({ navigate, to: (0, urls_1.withPathPrefix)(firstChild.link) });
|
|
75
75
|
}
|
|
76
76
|
setIsExpanded(!isExpanded);
|
|
77
77
|
}), [item, isExpanded, navigate, location.pathname, setIsExpanded]);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useProductPicker = useProductPicker;
|
|
4
4
|
const react_router_dom_1 = require("react-router-dom");
|
|
5
5
|
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
6
7
|
function useProductPicker() {
|
|
7
8
|
const { useCurrentProduct, useProducts, useTelemetry, useLoadAndNavigate } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
8
9
|
const currentProduct = useCurrentProduct();
|
|
@@ -14,7 +15,7 @@ function useProductPicker() {
|
|
|
14
15
|
if (!product)
|
|
15
16
|
return;
|
|
16
17
|
telemetry.sendProductPickedMessage({ product: product.slug });
|
|
17
|
-
loadAndNavigate({ navigate, to: product.link });
|
|
18
|
+
loadAndNavigate({ navigate, to: (0, utils_1.withPathPrefix)(product.link) });
|
|
18
19
|
}
|
|
19
20
|
return {
|
|
20
21
|
currentProduct,
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import type { MenuItemProps } from '../../types/sidebar';
|
|
|
6
6
|
import { useMenuItemExpanded } from './use-menu-item-expanded';
|
|
7
7
|
import { useCollapse } from './use-collapse';
|
|
8
8
|
import { loadAndNavigate } from '../../utils/load-and-navigate';
|
|
9
|
-
import { withoutPathPrefix } from '../../utils/urls';
|
|
9
|
+
import { withoutPathPrefix, withPathPrefix } from '../../utils/urls';
|
|
10
10
|
|
|
11
11
|
type NestedMenuProps = MenuItemProps & {
|
|
12
12
|
labelRef?: React.RefObject<HTMLElement | null>;
|
|
@@ -78,7 +78,7 @@ export function useNestedMenu({ item, labelRef, nestedMenuRef }: NestedMenuProps
|
|
|
78
78
|
|
|
79
79
|
const [firstChild] = item.items;
|
|
80
80
|
if (!isExpanded && item.selectFirstItemOnExpand && firstChild.link) {
|
|
81
|
-
await loadAndNavigate({ navigate, to: firstChild.link });
|
|
81
|
+
await loadAndNavigate({ navigate, to: withPathPrefix(firstChild.link) });
|
|
82
82
|
}
|
|
83
83
|
setIsExpanded(!isExpanded);
|
|
84
84
|
}, [item, isExpanded, navigate, location.pathname, setIsExpanded]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useNavigate } from 'react-router-dom';
|
|
2
2
|
|
|
3
3
|
import { useThemeHooks } from './use-theme-hooks';
|
|
4
|
+
import { withPathPrefix } from '../utils';
|
|
4
5
|
|
|
5
6
|
export function useProductPicker() {
|
|
6
7
|
const { useCurrentProduct, useProducts, useTelemetry, useLoadAndNavigate } = useThemeHooks();
|
|
@@ -12,7 +13,7 @@ export function useProductPicker() {
|
|
|
12
13
|
function setProduct(product: typeof currentProduct) {
|
|
13
14
|
if (!product) return;
|
|
14
15
|
telemetry.sendProductPickedMessage({ product: product.slug });
|
|
15
|
-
loadAndNavigate({ navigate, to: product.link });
|
|
16
|
+
loadAndNavigate({ navigate, to: withPathPrefix(product.link) });
|
|
16
17
|
}
|
|
17
18
|
return {
|
|
18
19
|
currentProduct,
|