Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
77 additions
and
286 deletions.
There are no files selected for viewing
38 changes: 0 additions & 38 deletions
38
spec/dummy/app/views/pages/deferred_render_with_server_rendering.html.erb
This file was deleted.
Oops, something went wrong.
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.
28 changes: 0 additions & 28 deletions
28
spec/dummy/client/app/components/DeferredRenderAsyncPage.jsx
This file was deleted.
Oops, something went wrong.
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,13 +1,8 @@ | ||
import React from 'react'; | ||
import { Route } from 'react-router'; | ||
import { Route } from 'react-router-dom'; | ||
|
||
import RouterLayout from '../components/RouterLayout'; | ||
import RouterFirstPage from '../components/RouterFirstPage'; | ||
import RouterSecondPage from '../components/RouterSecondPage'; | ||
|
||
export default ( | ||
<Route path="react_router" component={RouterLayout}> | ||
<Route path="first_page" component={RouterFirstPage} /> | ||
<Route path="second_page" component={RouterSecondPage} /> | ||
</Route> | ||
<Route path="/react_router" component={RouterLayout} /> | ||
); |
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,9 +1,9 @@ | ||
import React from 'react'; | ||
import { Router, browserHistory } from 'react-router'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import routes from '../routes/routes'; | ||
|
||
export default (props) => ( | ||
<Router history={browserHistory} {...props}> | ||
<BrowserRouter {...props}> | ||
{routes} | ||
</Router> | ||
</BrowserRouter> | ||
); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,29 +1,12 @@ | ||
import React from 'react'; | ||
import { match, RouterContext } from 'react-router'; | ||
import { StaticRouter } from 'react-router-dom'; | ||
|
||
import routes from '../routes/routes'; | ||
|
||
export default (_props, railsContext) => { | ||
let error; | ||
let redirectLocation; | ||
let routeProps; | ||
|
||
const { location } = railsContext; | ||
|
||
// See https://github.com/reactjs/react-router/blob/master/docs/guides/ServerRendering.md | ||
match({ routes, location }, (_error, _redirectLocation, _routeProps) => { | ||
error = _error; | ||
redirectLocation = _redirectLocation; | ||
routeProps = _routeProps; | ||
}); | ||
|
||
// This tell react_on_rails to skip server rendering any HTML. Note, client rendering | ||
// will handle the redirect. What's key is that we don't try to render. | ||
// Critical to return the Object properties to match this { error, redirectLocation } | ||
if (error || redirectLocation) { | ||
return { error, redirectLocation }; | ||
} | ||
|
||
// Important that you don't do this if you are redirecting or have an error. | ||
return () => <RouterContext {...routeProps} />; | ||
export default (props, railsContext) => { | ||
return () => ( | ||
<StaticRouter location={railsContext.location} {...props}> | ||
{routes} | ||
</StaticRouter> | ||
); | ||
}; |
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
Oops, something went wrong.