mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-07 21:32:38 +02:00
chore(v2): TypeScript, use isolatedModules (#4790)
* Use isolatedModules * better solution for useDocs? * fix blog-only mode * fix bad useDocs import
This commit is contained in:
parent
aaeda674b1
commit
01adf25b0f
5 changed files with 17 additions and 29 deletions
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import {useLocation} from '@docusaurus/router';
|
||||
import {
|
||||
useAllPluginInstancesData,
|
||||
import useGlobalData, {
|
||||
// useAllPluginInstancesData,
|
||||
usePluginData,
|
||||
} from '@docusaurus/useGlobalData';
|
||||
|
||||
|
@ -24,8 +24,11 @@ import {
|
|||
GetActivePluginOptions,
|
||||
} from '../../client/docsClientUtils';
|
||||
|
||||
// Not using useAllPluginInstancesData() because in blog-only mode, docs hooks are still used by the theme
|
||||
// We need a fail-safe fallback when the docs plugin is not in use
|
||||
export const useAllDocsData = (): Record<string, GlobalPluginData> =>
|
||||
useAllPluginInstancesData('docusaurus-plugin-content-docs');
|
||||
// useAllPluginInstancesData('docusaurus-plugin-content-docs');
|
||||
useGlobalData()['docusaurus-plugin-content-docs'] ?? {};
|
||||
|
||||
export const useDocsData = (pluginId: string | undefined): GlobalPluginData =>
|
||||
usePluginData('docusaurus-plugin-content-docs', pluginId) as GlobalPluginData;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue