-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3556 from avanderhoorn/update-getChildRoutes-with…
…-progressState Make `params` available to getChildRoutes providers
- Loading branch information
Showing
9 changed files
with
84 additions
and
35 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
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