-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make params
available to getChildRoutes providers
#3556
Merged
taion
merged 13 commits into
remix-run:master
from
avanderhoorn:update-getChildRoutes-with-progressState
Jun 21, 2016
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a81788b
Initial POC of making params and remainingPathname available to getCh…
avanderhoorn 2c90d04
Update given feedback on when to call createParams
avanderhoorn 8e2576f
Update documentation
avanderhoorn 61c64f7
Update samples and tests usage of location to progressState
avanderhoorn d3b7ce5
Rename from partialState to partialNextState
avanderhoorn bfb18e6
Remove usage of remainingPathname for the moment
avanderhoorn 400734e
Add unit tests
avanderhoorn b8c1820
Update and consolidate tests
avanderhoorn 3bf3fa9
Fixup whitespace issues
avanderhoorn 414b612
Setup spy to observe changes
avanderhoorn f566bf4
Fix extra white space
avanderhoorn 56353f4
Hopefully last one
avanderhoorn 2aa9a9e
Nope 2 more
avanderhoorn 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
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import warning from './routerWarning' | ||
import { canUseMembrane } from './deprecateObjectProperties' | ||
|
||
// No-op by default. | ||
let deprecateLocationProperties = () => {} | ||
|
||
if (__DEV__ && canUseMembrane) { | ||
deprecateLocationProperties = (nextState, location) => { | ||
const nextStateWithLocation = { ...nextState } | ||
|
||
// I don't use deprecateObjectProperties here because I want to keep the | ||
// same code path between development and production, in that we just | ||
// assign extra properties to the copy of the state object in both cases. | ||
for (const prop in location) { | ||
if (!Object.prototype.hasOwnProperty.call(location, prop)) { | ||
continue | ||
} | ||
|
||
Object.defineProperty(nextStateWithLocation, prop, { | ||
get() { | ||
warning(false, 'Accessing location properties from the first argument to `getComponent` and `getComponents` is deprecated. That argument is now the router state (`nextState`) rather than the location. To access the location, use `nextState.location`.') | ||
return location[prop] | ||
} | ||
}) | ||
} | ||
|
||
return nextStateWithLocation | ||
} | ||
} | ||
|
||
export default deprecateLocationProperties |
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
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.
I would call this
partialNextState
– we use the term elsewhere for partial next state.Can we omit
remainingPathname
here? I don't think it makes sense to pass down at this point. It feels odd for child routes to explicitly depend on the not-yet-matched portion of a route.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.
partialNextState
is fine.