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

Upgrade demo and packages to support 3.7.0 #1064

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"re-gen": "yarn clean-all-versions && yarn gen-all-versions"
},
"dependencies": {
"@docusaurus/core": "3.6.3",
"@docusaurus/faster": "3.6.3",
"@docusaurus/plugin-google-gtag": "3.6.3",
"@docusaurus/preset-classic": "3.6.3",
"@docusaurus/core": "3.7.0",
"@docusaurus/faster": "3.7.0",
"@docusaurus/plugin-google-gtag": "3.7.0",
"@docusaurus/preset-classic": "3.7.0",
"clsx": "^1.1.1",
"docusaurus-plugin-openapi-docs": "^4.3.1",
"docusaurus-theme-openapi-docs": "^4.3.1",
"prism-react-renderer": "^2.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^19.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded to React 19 which is required by 3.7.0

"react-dom": "^19.0.0"
},
"browserslist": {
"production": [
Expand Down
4 changes: 2 additions & 2 deletions demo/src/components/BrowserWindow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/

import React, { type CSSProperties, type ReactNode } from "react";
import React, { type CSSProperties, type ReactNode, type JSX } from "react";
import clsx from "clsx";

import styles from "./styles.module.css";

interface Props {
children: ReactNode;
children: JSX.Element;
minHeight?: number;
url: string;
style?: CSSProperties;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"semver": "^7.3.5",
"start-server-and-test": "^1.14.0",
"ts-jest": "^27.0.6",
"typescript": "^4.9.5"
"typescript": "^5.1"
},
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function groupByTags(
);
const tagObject = tags.flat().find(
(t) =>
tag === t.name ?? {
tag === t.name && {
name: tag,
description: `${tag} Index`,
}
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-openapi-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"@docusaurus/theme-common": "^3.5.0",
"docusaurus-plugin-openapi-docs": "^4.0.0",
"docusaurus-plugin-sass": "^0.2.3",
"react": "^16.8.4 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0"
"react": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import React, { useState, useEffect } from "react";
import React, { useState, useEffect, type JSX } from "react";

import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import ApiCodeBlock from "@theme/ApiExplorer/ApiCodeBlock";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function TabList({
tabValues,
}: CodeTabsProps & ReturnType<typeof useTabs>) {
const tabRefs = useRef<(HTMLLIElement | null)[]>([]);
const tabsScrollContainerRef = useRef<any>();
const tabsScrollContainerRef = useRef<any>(null);
const { blockElementScrollPositionUntilNextRender } =
useScrollPositionBlocker();

Expand Down Expand Up @@ -163,7 +163,11 @@ function TabList({
tabIndex={selectedValue === value ? 0 : -1}
aria-selected={selectedValue === value}
key={value}
ref={(tabControl) => tabRefs.current.push(tabControl)}
ref={(tabControl) => {
if (tabControl) {
tabRefs.current.push(tabControl);
}
}}
onKeyDown={handleKeydown}
onClick={handleTabChange}
{...attributes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import React, { useEffect, useState } from "react";
import React, { type JSX, useEffect, useState } from "react";

import { usePrismTheme } from "@docusaurus/theme-common";
import useIsBrowser from "@docusaurus/useIsBrowser";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import React from "react";
import React, { type JSX } from "react";

import { useDoc } from "@docusaurus/plugin-content-docs/client";
import { useWindowSize } from "@docusaurus/theme-common";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function ApiItem(props: Props): JSX.Element {
if (api) {
try {
api = JSON.parse(
zlib.inflateSync(Buffer.from(api as any, "base64")).toString()
zlib.inflateSync(Buffer.from(api as any, "base64") as any).toString()
);
} catch {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ function TabList({
tabIndex={selectedValue === value ? 0 : -1}
aria-selected={selectedValue === value}
key={value}
ref={(tabControl) => tabRefs.push(tabControl)}
ref={(tabControl) => {
tabRefs.push(tabControl);
}}
onKeyDown={handleKeydown}
onClick={handleTabChange}
{...attributes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ function TabList({
tabIndex={selectedValue === value ? 0 : -1}
aria-selected={selectedValue === value}
key={value}
ref={(tabControl) => tabRefs.push(tabControl)}
ref={(tabControl) => {
tabRefs.push(tabControl);
}}
onKeyDown={handleKeydown}
onClick={handleTabChange}
{...attributes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ function TabList({
tabIndex={selectedValue === value ? 0 : -1}
aria-selected={selectedValue === value}
key={value}
ref={(tabControl) => tabRefs.push(tabControl)}
ref={(tabControl) => {
tabRefs.push(tabControl);
}}
onKeyDown={handleKeydown}
onFocus={handleTabChange}
onClick={(e) => handleTabChange(e)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ function TabList({
tabIndex={selectedValue === value ? 0 : -1}
aria-selected={selectedValue === value}
key={value}
ref={(tabControl) => tabRefs.push(tabControl)}
ref={(tabControl) => {
tabRefs.push(tabControl);
}}
onKeyDown={handleKeydown}
onFocus={handleTabChange}
onClick={(e) => handleTabChange(e)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import React, { Suspense } from "react";
import React from "react";

import BrowserOnly from "@docusaurus/BrowserOnly";
import Details from "@theme/Details";
Expand Down Expand Up @@ -72,14 +72,7 @@ const ParamsDetails: React.FC<Props> = (props) => {
return (
<BrowserOnly fallback={<SkeletonLoader size="sm" />}>
{() => {
const LazyComponent = React.lazy(() =>
Promise.resolve({ default: ParamsDetailsComponent })
);
return (
<Suspense fallback={null}>
<LazyComponent {...props} />
</Suspense>
);
return <ParamsDetailsComponent {...props} />;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed use of Suspense for handling lazy loading of component...now relying strictly on BrowserOnly.

}}
</BrowserOnly>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import React, { Suspense } from "react";
import React from "react";

import BrowserOnly from "@docusaurus/BrowserOnly";
import Details from "@theme/Details";
Expand Down Expand Up @@ -148,14 +148,7 @@ const RequestSchema: React.FC<Props> = (props) => {
return (
<BrowserOnly fallback={<SkeletonLoader size="sm" />}>
{() => {
const LazyComponent = React.lazy(() =>
Promise.resolve({ default: RequestSchemaComponent })
);
return (
<Suspense fallback={null}>
<LazyComponent {...props} />
</Suspense>
);
return <RequestSchemaComponent {...props} />;
}}
</BrowserOnly>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import React, { Suspense } from "react";
import React from "react";

import BrowserOnly from "@docusaurus/BrowserOnly";
import Details from "@theme/Details";
Expand Down Expand Up @@ -135,14 +135,7 @@ const ResponseSchema: React.FC<Props> = (props) => {
return (
<BrowserOnly fallback={<SkeletonLoader size="md" />}>
{() => {
const LazyComponent = React.lazy(() =>
Promise.resolve({ default: ResponseSchemaComponent })
);
return (
<Suspense fallback={null}>
<LazyComponent {...props} />
</Suspense>
);
return <ResponseSchemaComponent {...props} />;
}}
</BrowserOnly>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ function TabList({
tabIndex={selectedValue === value ? 0 : -1}
aria-selected={selectedValue === value}
key={value}
ref={(tabControl) => tabRefs.push(tabControl)}
ref={(tabControl) => {
tabRefs.push(tabControl);
}}
onKeyDown={handleKeydown}
onClick={handleTabChange}
{...attributes}
Expand Down
Loading
Loading