Skip to content

Commit

Permalink
loads and moves it above our routing setup allowing it to code-split…
Browse files Browse the repository at this point in the history
… with minimum dependencies
  • Loading branch information
lorenjohnson committed Oct 21, 2022
1 parent 62205c8 commit ae68db8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 28 deletions.
19 changes: 16 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import React from 'react'
import React, { Suspense } from 'react'
import ReactDOM from 'react-dom'
import { rootDomId } from 'client/util'
import App from './router'
import Loading from 'components/Loading'

import './client/websockets'
import './css/global/index.scss'

const App = React.lazy(() => import('./router'))
const HyloEditorMobile = React.lazy(() => import('components/HyloEditor/HyloEditorMobile'))

ReactDOM.render(
<App />,
window.location.pathname === '/hyloApp/editor'
? (
<Suspense fallback={() => null}>
<HyloEditorMobile />
</Suspense>
) : (
<Suspense fallback={() => <Loading type='fullscreen' />}>
<App />
</Suspense>
),
document.getElementById(rootDomId)
)
7 changes: 1 addition & 6 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from 'react'
import { ConnectedRouter } from 'connected-react-router'
import { Switch, Route } from 'react-router'
import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'
import { Provider } from 'react-redux'
import { LayoutFlagsProvider } from 'contexts/LayoutFlagsContext'
import createStore, { history } from '../store'
import RootRouter from 'routes/RootRouter'
import HyloAppRouter from 'routes/HyloAppRouter'

const store = createStore()

Expand All @@ -19,10 +17,7 @@ export default function App () {
<DndProvider backend={HTML5Backend}>
<Provider store={store}>
<ConnectedRouter history={history}>
<Switch>
<Route path='/hyloApp' component={HyloAppRouter} />
<RootRouter />
</Switch>
<RootRouter />
</ConnectedRouter>
</Provider>
</DndProvider>
Expand Down
16 changes: 0 additions & 16 deletions src/routes/HyloAppRouter/HyloAppRouter.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/routes/HyloAppRouter/index.js

This file was deleted.

0 comments on commit ae68db8

Please sign in to comment.