Skip to content

Commit

Permalink
perf: lazy load of redoc app
Browse files Browse the repository at this point in the history
  • Loading branch information
ogiorgis committed Feb 14, 2025
1 parent ae9681e commit 83a489d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 3 additions & 10 deletions ui/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Route, Switch } from 'react-router-dom';
import { hot } from 'react-hot-loader/root';
import { ConnectedRouter } from 'connected-react-router';
import { Provider } from 'react-redux';
import { RedocStandalone } from 'redoc';

import { permaLinkPrefix } from './perfherder/perf-helpers/constants';
import { configureStore, history } from './job-view/redux/configureStore';
Expand All @@ -27,6 +26,8 @@ const JobsViewApp = lazy(() => import('./job-view/App'));

const LogviewerApp = lazy(() => import('./logviewer/App'));

const RedocApp = lazy(() => import('./RedocApp'));

// backwards compatibility for routes like this: treeherder.mozilla.org/perf.html#/alerts?id=26622&hideDwnToInv=0
const updateOldUrls = () => {
const { pathname, hash, search } = history.location;
Expand Down Expand Up @@ -176,15 +177,7 @@ const App = () => {
withFavicon(<PerfherderApp {...props} />, '/perfherder')
}
/>
<Route
path="/docs"
render={(props) => (
<RedocStandalone
specUrl="/api/schema/?format=openapi-json"
{...props}
/>
)}
/>
<Route path="/docs" render={(props) => <RedocApp {...props} />} />
</Switch>
</Suspense>
</ConnectedRouter>
Expand Down
10 changes: 10 additions & 0 deletions ui/RedocApp.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { RedocStandalone } from 'redoc';

const App = (props) => {
return (
<RedocStandalone specUrl="/api/schema/?format=openapi-json" {...props} />
);
};

export default App;

0 comments on commit 83a489d

Please sign in to comment.