-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into docs-configs-1
- Loading branch information
Showing
12 changed files
with
409 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
import React from 'react'; | ||
import usePromise from 'react-promise'; | ||
import BrowserOnly from '@docusaurus/BrowserOnly'; | ||
|
||
|
||
const Redoc = (props) => { | ||
|
||
const Redoc = (props) => ( | ||
<BrowserOnly fallback={<div>Pre-rendering...</div>}> | ||
{() => { | ||
// we need to import this here instead of at the top-level | ||
// because it causes issues in production builds | ||
const RedocStandalone = require('redoc').RedocStandalone; | ||
return <RedocStandalone {...props} />; | ||
}} | ||
</BrowserOnly> | ||
); | ||
const getRedocStandalone = React.useCallback(async () => { | ||
// using import() instead of require() keeps the package tree-shakeable. | ||
const redoc = await import('redoc'); | ||
return redoc.RedocStandalone; | ||
}, []); | ||
|
||
return ( | ||
<BrowserOnly fallback={<div>Loading...</div>}> | ||
{() => { | ||
// we need to import this here instead of at the top-level | ||
// because it causes issues in production builds | ||
const {value: RedocStandalone, loading} = usePromise(getRedocStandalone); | ||
return loading ? <div>Loading...</div> : <RedocStandalone {...props} />; | ||
}} | ||
</BrowserOnly> | ||
); | ||
} | ||
|
||
export default Redoc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.