refactor(theme-classic): extract doc-related navbar items' logic to theme-common (#7067)

This commit is contained in:
Joshua Chen 2022-03-30 14:50:04 +08:00 committed by GitHub
parent fd24bd180d
commit 13e7de853e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 166 additions and 135 deletions

View file

@ -198,8 +198,11 @@ function useDocsPreferredVersionContext(): ContextValue {
}
/**
* Returns a read-write interface to a plugin's preferred version.
* Note, the `preferredVersion` attribute will always be `null` before mount.
* Returns a read-write interface to a plugin's preferred version. The
* "preferred version" is defined as the last version that the user visited.
* For example, if a user is using v3, even when v4 is later published, the user
* would still be browsing v3 docs when she opens the website next time. Note,
* the `preferredVersion` attribute will always be `null` before mount.
*/
export function useDocsPreferredVersion(
pluginId: string | undefined = DEFAULT_PLUGIN_ID,