This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Updated react-redux bindings to v6 and updated examples #103
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { combineReducers } from 'redux' | ||
import { namespaced } from 'redux-subspace' | ||
import { connectRouter } from 'connected-react-router' | ||
import { reducer as app } from '../../app' | ||
import configuration from './configuration' | ||
|
||
export default combineReducers({ | ||
export default history => combineReducers({ | ||
app: namespaced('app')(app), | ||
configuration | ||
configuration, | ||
router: connectRouter(history) | ||
}) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll see this a lot in the review. When
lerna
links the packages usingnpm link
they end up with different instances ofreact-redux
so theReact.createContext(...)
calls create a different context soreact-redux-subspace
cannot access the store from the examplesProvider
. This follows the "BYO contextconcept from
react-redux` but provides the actual context instance from the example's version.This works, but it's a bit gross and not really how you would use in a real app, which makes having it in all the examples a bit annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one annoying thing about reacts new context api.
Could we have a post install script that removes the nested react-redux packages in node_modules so they all resolve to the same one?
At least then the fix is hidden away in the package.json and not in the example code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, that would break the build of the actual package... Ignore that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with that is the file is not in the same directory tree, so the node package resolution does not find the package at all. I have done a trick in the past to
npm link
the troublesome package back to the other's as a post-installation task, but I found it to be slow and required a bit of hacking about to get working. At least this is actual functionality offered by bothreact-redux
and nowredux-subspace
, it just sucks a bit that it's the defacto example.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least it won't break if someone uses it in production code (it'll be the same as the default value)
Maybe adjust the comment a bit to make it more obvious?
"// Note: please don't copy this line (and associated prop usage) to your project, you are unlikely to need to do this for standard subspace usage.
// This is caused by lerna using npm link..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol at autocorrect, but I like the idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'll teach me for reviewing on my phone.