Skip to content

Commit 6a83e54

Browse files
committed
changing version from more
1 parent 85de00b commit 6a83e54

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/components/HeaderNav.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,19 @@ const setActive = (target: HTMLElement | null) => {
7777
}
7878
7979
const handleMore = (command: string) => {
80+
console.log('handleMore called with command:', command)
8081
let element = document.getElementById("selected-api-version")
8182
if (element !== null) {
8283
element.textContent = command;
8384
}
8485
if (command.includes('_')) {
86+
console.log('Navigating to message docs:', command)
8587
router.push({ name: 'message-docs', params: { id: command } })
8688
} else {
87-
router.replace({ path: `/resource-docs/${command}` })
89+
console.log('Navigating to resource docs:', `/resource-docs/${command}`)
90+
console.log('Current route:', route.path)
91+
// Clear operationid query param when changing versions to avoid showing non-existent operation
92+
router.replace({ path: `/resource-docs/${command}`, query: {} })
8893
}
8994
}
9095

src/components/Preview.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ const roleForm = reactive({})
7474
7575
const setOperationDetails = (id: string, version: string): void => {
7676
const operation = getOperationDetails(version, id, resourceDocs)
77+
78+
// Safety check: if operation doesn't exist (e.g., after version change), return early
79+
if (!operation) {
80+
console.warn(`Operation "${id}" not found in version "${version}"`)
81+
return
82+
}
83+
7784
// Replace the version in the URL with the current viewing version
7885
// This ensures users test against the version they're viewing (e.g., v6.0.0)
7986
// even if the endpoint was originally defined in an earlier version (e.g., v3.1.0)

0 commit comments

Comments
 (0)