Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook useTabGroupChoice is called outside the <TabGroupChoiceProvider> #78

Closed
AustinHunt opened this issue May 7, 2022 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@AustinHunt
Copy link

Describe the bug

Attempting to use the yarn docusaurus gen-api-docs all command to generate docs. Got the base route to render, but when I click on any other route I get a "This page crashed" error with "Hook useTabGroupChoice is called outside the <TabGroupChoiceProvider>."

My config

// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').Config} */
const config = {
  title: "HailTrace",
  tagline: "Developer Documentation",
  url: "https://developers.hailtrace.com",
  baseUrl: "/",
  onBrokenLinks: "throw",
  onBrokenMarkdownLinks: "warn",
  favicon: "img/favicon.ico",

  // GitHub pages deployment config.
  // If you aren't using GitHub pages, you don't need these.
  // organizationName: "hailtrace", // Usually your GitHub org/user name.
  // projectName: "docusaurus", // Usually your repo name.

  // Even if you don't use internalization, you can use this field to set useful
  // metadata like html lang. For example, if your site is Chinese, you may want
  // to replace "en" with "zh-Hans".
  i18n: {
    defaultLocale: "en",
    locales: ["en"],
  },

  presets: [
    [
      "classic",
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
          docLayoutComponent: "@theme/DocPage",
          docItemComponent: "@theme/ApiItem", // Derived from docusaurus-theme-openapi-docs
        },
        blog: {
          showReadingTime: true,
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
        },
        theme: {
          customCss: require.resolve("./src/css/custom.css"),
        },
      }),
    ],
  ],
  plugins: [
    [
      "docusaurus-plugin-openapi-docs",
      {
        id: "openapi",
        config: {
          api: {
            // Note: petstore key is treated as the <id> and can be used to specify an API doc instance when using CLI commands
            specPath: "openapi/openapi.yaml", // Path to designated spec file
            outputDir: "api/openapi", // Output directory for generated .mdx docs
            sidebarOptions: {
              groupPathsBy: "tags",
            },
          },
        },
      },
    ],
    [
      "content-docs",
      {
        id: "openapi",
        path: "api",
        breadcrumbs: true,
        routeBasePath: "api",
        include: ["**/*.md", "**/*.mdx"],
        sidebarPath: "apiSidebars.js",
        docLayoutComponent: "@theme/DocPage", // This solves the providers issue and drop the need for ApiPage component
        docItemComponent: "@theme/ApiItem", // Will probably need to clean this up/refactor to get it fully updated
        remarkPlugins: [],
        rehypePlugins: [],
        beforeDefaultRemarkPlugins: [],
        beforeDefaultRehypePlugins: [],
        showLastUpdateAuthor: true, // We can now add stuff like this :)
        showLastUpdateTime: true,
      },
    ],
  ],
  themes: ["docusaurus-theme-openapi-docs"],
  themeConfig:
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    ({
      navbar: {
        title: "HailTrace",
        logo: {
          alt: "My Site Logo",
          src: "img/logo.svg",
        },
        items: [
          {
            to: "/api/openapi",
            position: "left",
            label: "OpenApi",
          },
          { to: "/blog", label: "Blog", position: "left" },
          {
            href: "https://github.com/facebook/docusaurus",
            label: "GitHub",
            position: "right",
          },
        ],
      },
      footer: {
        style: "dark",
        links: [
          {
            title: "Docs",
            items: [
              {
                label: "Tutorial",
                to: "/docs/intro",
              },
            ],
          },
          {
            title: "Community",
            items: [
              {
                label: "Stack Overflow",
                href: "https://stackoverflow.com/questions/tagged/hailtrace",
              },
              {
                label: "Twitter",
                href: "https://twitter.com/hailtrace",
              },
            ],
          },
          {
            title: "More",
            items: [
              {
                label: "Blog",
                to: "/blog",
              },
              {
                label: "GitHub",
                href: "https://github.com/hailtrace",
              },
            ],
          },
        ],
        copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
      },
      prism: {
        theme: lightCodeTheme,
        darkTheme: darkCodeTheme,
      },
    }),
};

module.exports = config;
  • Version used: 1.0.1 (plugin and theme)
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): Chrome 100.0.4896.127
  • Operating System and version (desktop or mobile): MacOS Monterey
@AustinHunt AustinHunt added the bug Something isn't working label May 7, 2022
@welcome-to-palo-alto-networks
Copy link

🎉 Thanks for opening your first issue here! Welcome to the community!

@AustinHunt
Copy link
Author

Ah, 2.0.0-beta.20 is the issue. If I downgrade to 2.0.0-beta.18 I'm good.

@sserrata
Copy link
Member

sserrata commented May 9, 2022

Hi @AustinHunt, we're actively working to support beta.20. Meanwhile, we'll update the README/docs to highlight that the plugin currently only works with 2.0.0-beta.18. Thanks!

@sserrata
Copy link
Member

sserrata commented May 9, 2022

Using #79 to continue tracking this issue.

@sserrata sserrata closed this as completed May 9, 2022
@AustinHunt
Copy link
Author

@sserrata This is a nice docusaurus-native plugin. Issue was that it is definitely not mature enough yet for our use case at the moment. We'll keep monitoring your progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants