Skip to content

Commit 0e862a5

Browse files
David Liurohit-gohri
David Liu
andauthored
Adding onLoaded callback for RedocStandalone (#128)
Co-authored-by: Rohit Gohri <work@rohit.page>
1 parent 9e66c76 commit 0e862a5

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.changeset/tricky-wasps-attack.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"docusaurus-theme-redoc": minor
3+
---
4+
5+
Adding onLoaded callback for RedocStandalone

packages/docusaurus-theme-redoc/src/theme/Redoc/Redoc.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Redoc(props: Props): JSX.Element {
1717
'docusaurus-theme-redoc',
1818
);
1919
const theme = isDarkTheme ? darkTheme : lightTheme;
20-
const { spec, specUrl } = props;
20+
const { spec, specUrl, onLoaded } = props;
2121
const store = useMemo(() => {
2222
if (!spec) return null;
2323
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -39,6 +39,7 @@ function Redoc(props: Props): JSX.Element {
3939
...redocOptions,
4040
theme,
4141
}}
42+
onLoaded={onLoaded}
4243
/>
4344
)}
4445
</div>

packages/docusaurus-theme-redoc/src/types/common.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import type { Props as LayoutProps } from '@theme/Layout';
2-
import type { RedocRawOptions, ObjectDescriptionProps } from 'redoc';
2+
import type {
3+
RedocRawOptions,
4+
ObjectDescriptionProps,
5+
RedocStandaloneProps,
6+
} from 'redoc';
37
import type { RecursivePartial } from './util';
48

5-
export type RedocProps = {
9+
export interface RedocProps
10+
extends Omit<RedocStandaloneProps, 'spec' | 'specUrl' | 'options'> {
611
spec?: Record<string, unknown>;
712
specUrl?: string;
8-
};
13+
}
914

1015
export type ApiSchemaProps = Omit<
1116
ObjectDescriptionProps,

0 commit comments

Comments
 (0)