Skip to content
Merged
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
14 changes: 13 additions & 1 deletion packages/plugin-docusaurus-v3/src/theme/SearchBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,26 @@ export function OramaSearchNoDocs() {
)
}

function getVersionName(version: string | { name: string } | null): string | undefined {
if (!version) {
return undefined
}

if (typeof version === 'string') {
return version
}

return version.name
}

export function OramaSearchWithDocs({ pluginId }: { pluginId: string }) {
const colorMode = getColorMode()
const { searchBoxConfig, searchBtnConfig } = useOrama()
const collectionManager = searchBoxConfig.basic?.collectionManager
const versions = useVersions(pluginId)
const activeVersion = useActiveVersion(pluginId)
const preferredVersion = getPreferredVersion(searchBoxConfig.basic.clientInstance)
const currentVersion = activeVersion || preferredVersion || versions[0]
const currentVersion = getVersionName(activeVersion) || getVersionName(preferredVersion) || getVersionName(versions[0]);

const searchParams = {
...(currentVersion && {
Expand Down