Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/utils/navigatorData.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function extractRootNode(data) {
// the URL in situations where the renderer is being hosted at some path
// prefix
const rootPathPattern = /(\/documentation\/[^/]+)/;
const rootPath = window.location.href.match(rootPathPattern)?.[1] ?? '';
const rootPath = window.location.pathname.match(rootPathPattern)?.[1] ?? '';
// most of the time, it is expected that `data` always has a single item
// that represents the top-level root node of the navigation tree
//
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils/navigatorData.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ describe('when multiple top-level children are provided', () => {
describe('flattenNavigationIndex', () => {
it('prefers the root child with the same url path prefix', () => {
Object.defineProperty(window, 'location', {
value: { href: 'http://localhost/documentation/b/b42' },
value: new URL('http://localhost/documentation/b/b42?language=objc'),
});

// use first root node if only one is provided
Expand Down Expand Up @@ -409,7 +409,7 @@ describe('when multiple top-level children are provided', () => {
describe('extractTechnologyProps', () => {
it('prefers the root child with the same url path prefix', () => {
Object.defineProperty(window, 'location', {
value: { href: 'http://localhost/documentation/b/b42' },
value: new URL('http://localhost/documentation/b/b42?language=objc'),
});

// use first root node if only one is provided
Expand Down