-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Had to work around no shared store support * See shakacode/react_on_rails#504
- Loading branch information
Showing
7 changed files
with
80 additions
and
19 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
33 changes: 33 additions & 0 deletions
33
client/app/bundles/comments/startup/ClientRouterAppExpress.jsx
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Compare to ../ServerRouterApp.jsx | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import ReactOnRails from 'react-on-rails'; | ||
import { Router, browserHistory } from 'react-router'; | ||
import routes from '../routes/routes'; | ||
import { syncHistoryWithStore } from 'react-router-redux'; | ||
|
||
// Because of https://github.com/shakacode/react_on_rails/issues/504 | ||
// we need to skip using a shared store for the express server startup. | ||
import createStore from '../store/routerCommentsStore'; | ||
|
||
const RouterAppExpress = (_props, _railsContext) => { | ||
|
||
// See comment above | ||
const store = createStore(_props); | ||
|
||
// Create an enhanced history that syncs navigation events with the store | ||
const history = syncHistoryWithStore( | ||
browserHistory, | ||
store | ||
); | ||
|
||
return ( | ||
<Provider store={store}> | ||
<Router history={history} children={routes} /> | ||
</Provider> | ||
); | ||
}; | ||
|
||
ReactOnRails.register({ | ||
RouterAppExpress, | ||
}); |
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