mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-15 01:57:28 +02:00
feat(v2): persist docs preferred version (#3543)
* persist docs preferred version * add proper implementation for useDocsPreferredVersion * add proper implementation for useDocsPreferredVersion * useDocsPreferredVersion => make localstorage read only after mount * why @docusaurus/constants can't work? * fix weird TS issue when not duplicating constants * add basic @docusaurus/constants doc * attempt to fix docs-only mode where we should not call useDocs hooks * attempt to fix docs-only mode where we should not call useDocs hooks * fix children * encapsulate hacky isDocsPluginEnabled in docsUtils * use same priority order for all navbar items: activeVersion ?? preferredVersion ?? latestVersion
This commit is contained in:
parent
d1510770f4
commit
4130f1a195
15 changed files with 344 additions and 12 deletions
|
@ -21,10 +21,10 @@ import {
|
|||
GetActivePluginOptions,
|
||||
} from '../../client/docsClientUtils';
|
||||
|
||||
const useAllDocsData = (): Record<string, GlobalPluginData> =>
|
||||
export const useAllDocsData = (): Record<string, GlobalPluginData> =>
|
||||
useAllPluginInstancesData('docusaurus-plugin-content-docs');
|
||||
|
||||
const useDocsData = (pluginId: string | undefined) =>
|
||||
export const useDocsData = (pluginId: string | undefined) =>
|
||||
usePluginData('docusaurus-plugin-content-docs', pluginId) as GlobalPluginData;
|
||||
|
||||
export const useActivePlugin = (options: GetActivePluginOptions = {}) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue