-
-
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
Add invariant for missing "to" property #5792
Merged
timdorr
merged 1 commit into
remix-run:master
from
selbekk:add-invariant-for-missing-to-property
Jan 5, 2018
Merged
Add invariant for missing "to" property #5792
timdorr
merged 1 commit into
remix-run:master
from
selbekk:add-invariant-for-missing-to-property
Jan 5, 2018
Conversation
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 commit adds a descriptive invariant violation error message whenever the consumer does not remember to set the "to" prop.
selbekk
force-pushed
the
add-invariant-for-missing-to-property
branch
from
December 14, 2017 22:03
3237c22
to
434bdc2
Compare
Oopsie, screwed up the test. Now we should be good to go 👍 |
timdorr
approved these changes
Dec 15, 2017
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.
Makes sense. Thanks!
pshrmn
approved these changes
Jan 5, 2018
bors bot
referenced
this pull request
in mozilla/delivery-console
Jun 6, 2018
179: Update dependency react-router-dom to v4.3.0 r=magopian a=renovate[bot] This Pull Request updates dependency [react-router-dom](https://github.com/ReactTraining/react-router) from `v4.2.2` to `v4.3.0` <details> <summary>Release Notes</summary> ### [`v4.3.0`](https://github.com/ReactTraining/react-router/blob/master/CHANGELOG.md#v430httpsgithubcomReactTrainingreact-routercomparev420v430) [Compare Source](remix-run/react-router@v4.3.0-rc.3...a27bc56) > Jun 6, 2018 * Use the `pretty` option in generatePath ([#​6172] by @​sibelius) * aria-current has incorrect value "true" ([#​6118] by @​brandonrninefive) * Redirect with parameters ([#​5209] by @​dlindenkreuz) * Fix with missing pathname: `<Link to="?foo=bar">` ([#​5489] by @​pshrmn) * Escape NavLink path to allow special characters in path. ([#​5596] by @​esiegel) * Expose `generatePath` ([#​5661] by @​rybon) * Use named import of history module. ([#​5589] by @​RoboBurned) * Hoist dependencies for smaller UMD builds ([#​5720] by @​pshrmn) * Remove aria-current from navLink when inactive ([#​5508] by @​AlmeroSteyn) * Add invariant for missing "to" property on `<Link>` ([#​5792] by @​selbekk) * Use Prettier on the code ([e6f9017] by @​mjackson) * Fix pathless route's match when parent is null ([#​5964] by @​pshrmn) * Use history.createLocation in `<StaticRouter>` ([#​5722] by @​pshrmn) [#​6172]: `https://github.com/ReactTraining/react-router/pull/6172` [#​6118]: `https://github.com/ReactTraining/react-router/pull/6118` [#​5209]: `https://github.com/ReactTraining/react-router/pull/5209` [#​5489]: `https://github.com/ReactTraining/react-router/pull/5489` [#​5596]: `https://github.com/ReactTraining/react-router/pull/5596` [#​5661]: `https://github.com/ReactTraining/react-router/pull/5661` [#​5589]: `https://github.com/ReactTraining/react-router/pull/5589` [#​5720]: `https://github.com/ReactTraining/react-router/pull/5720` [#​5508]: `https://github.com/ReactTraining/react-router/pull/5508` [#​5792]: `https://github.com/ReactTraining/react-router/pull/5792` [e6f9017]: remix-run/react-router@e6f9017 [#​5964]: `https://github.com/ReactTraining/react-router/pull/5964` [#​5722]: `https://github.com/ReactTraining/react-router/pull/5722` --- ### [`v4.3.0-rc.3`](https://github.com/ReactTraining/react-router/releases/v4.3.0-rc.3) [Compare Source](remix-run/react-router@v4.3.0-rc.2...v4.3.0-rc.3) - Fix broken UMD builds. - Add sideEffects: false for webpack tree shaking (#​6082 by @​taylorc93) --- ### [`v4.3.0-rc.2`](https://github.com/ReactTraining/react-router/releases/v4.3.0-rc.2) [Compare Source](remix-run/react-router@v4.3.0-rc.1...v4.3.0-rc.2) - Bump `hoist-non-react-statics` for React 16.3. - Missing `generatePath` in `react-router-dom` package. --- ### [`v4.3.0-rc.1`](https://github.com/ReactTraining/react-router/releases/v4.3.0-rc.1) [Compare Source](remix-run/react-router@v4.2.2...v4.3.0-rc.1) > Mar 26, 2018 - Redirect with parameters ([#​5209] by @​dlindenkreuz) - Fix with missing pathname: `<Link to="?foo=bar">` ([#​5489] by @​pshrmn) - Escape NavLink path to allow special characters in path. ([#​5596] by @​esiegel) - Expose `generatePath` ([#​5661] by @​rybon) - Use named import of history module. ([#​5589] by @​RoboBurned) - Hoist dependencies for smaller UMD builds ([#​5720] by @​pshrmn) - Remove aria-current from navLink when inactive ([#​5508] by @​AlmeroSteyn) - Add invariant for missing "to" property on `<Link>` ([#​5792] by @​selbekk) - Use Prettier on the code ([e6f9017] by @​mjackson) - Fix pathless route's match when parent is null ([#​5964] by @​pshrmn) - Use history.createLocation in `<StaticRouter>` ([#​5722] by @​pshrmn) [#​5209]: `https://github.com/ReactTraining/react-router/pull/5209` [#​5489]: `https://github.com/ReactTraining/react-router/pull/5489` [#​5596]: `https://github.com/ReactTraining/react-router/pull/5596` [#​5661]: `https://github.com/ReactTraining/react-router/pull/5661` [#​5589]: `https://github.com/ReactTraining/react-router/pull/5589` [#​5720]: `https://github.com/ReactTraining/react-router/pull/5720` [#​5508]: `https://github.com/ReactTraining/react-router/pull/5508` [#​5792]: `https://github.com/ReactTraining/react-router/pull/5792` [e6f9017]: remix-run/react-router@e6f9017 [#​5964]: `https://github.com/ReactTraining/react-router/pull/5964` [#​5722]: `https://github.com/ReactTraining/react-router/pull/5722` --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com). Co-authored-by: Renovate Bot <[email protected]>
bors bot
referenced
this pull request
in mozilla/delivery-console
Jun 6, 2018
178: Update dependency react-router to v4.3.0 r=magopian a=renovate[bot] This Pull Request updates dependency [react-router](https://github.com/ReactTraining/react-router) from `v4.2.0` to `v4.3.0` <details> <summary>Release Notes</summary> ### [`v4.3.0`](https://github.com/ReactTraining/react-router/blob/master/CHANGELOG.md#v430httpsgithubcomReactTrainingreact-routercomparev420v430) [Compare Source](remix-run/react-router@v4.3.0-rc.3...v4.3.0) > Jun 6, 2018 * Use the `pretty` option in generatePath ([#​6172] by @​sibelius) * aria-current has incorrect value "true" ([#​6118] by @​brandonrninefive) * Redirect with parameters ([#​5209] by @​dlindenkreuz) * Fix with missing pathname: `<Link to="?foo=bar">` ([#​5489] by @​pshrmn) * Escape NavLink path to allow special characters in path. ([#​5596] by @​esiegel) * Expose `generatePath` ([#​5661] by @​rybon) * Use named import of history module. ([#​5589] by @​RoboBurned) * Hoist dependencies for smaller UMD builds ([#​5720] by @​pshrmn) * Remove aria-current from navLink when inactive ([#​5508] by @​AlmeroSteyn) * Add invariant for missing "to" property on `<Link>` ([#​5792] by @​selbekk) * Use Prettier on the code ([e6f9017] by @​mjackson) * Fix pathless route's match when parent is null ([#​5964] by @​pshrmn) * Use history.createLocation in `<StaticRouter>` ([#​5722] by @​pshrmn) [#​6172]: `https://github.com/ReactTraining/react-router/pull/6172` [#​6118]: `https://github.com/ReactTraining/react-router/pull/6118` [#​5209]: `https://github.com/ReactTraining/react-router/pull/5209` [#​5489]: `https://github.com/ReactTraining/react-router/pull/5489` [#​5596]: `https://github.com/ReactTraining/react-router/pull/5596` [#​5661]: `https://github.com/ReactTraining/react-router/pull/5661` [#​5589]: `https://github.com/ReactTraining/react-router/pull/5589` [#​5720]: `https://github.com/ReactTraining/react-router/pull/5720` [#​5508]: `https://github.com/ReactTraining/react-router/pull/5508` [#​5792]: `https://github.com/ReactTraining/react-router/pull/5792` [e6f9017]: remix-run/react-router@e6f9017 [#​5964]: `https://github.com/ReactTraining/react-router/pull/5964` [#​5722]: `https://github.com/ReactTraining/react-router/pull/5722` --- ### [`v4.3.0-rc.3`](https://github.com/ReactTraining/react-router/releases/v4.3.0-rc.3) [Compare Source](remix-run/react-router@v4.3.0-rc.2...v4.3.0-rc.3) - Fix broken UMD builds. - Add sideEffects: false for webpack tree shaking (#​6082 by @​taylorc93) --- ### [`v4.3.0-rc.2`](https://github.com/ReactTraining/react-router/releases/v4.3.0-rc.2) [Compare Source](remix-run/react-router@v4.3.0-rc.1...v4.3.0-rc.2) - Bump `hoist-non-react-statics` for React 16.3. - Missing `generatePath` in `react-router-dom` package. --- ### [`v4.3.0-rc.1`](https://github.com/ReactTraining/react-router/releases/v4.3.0-rc.1) [Compare Source](remix-run/react-router@v4.2.0...v4.3.0-rc.1) > Mar 26, 2018 - Redirect with parameters ([#​5209] by @​dlindenkreuz) - Fix with missing pathname: `<Link to="?foo=bar">` ([#​5489] by @​pshrmn) - Escape NavLink path to allow special characters in path. ([#​5596] by @​esiegel) - Expose `generatePath` ([#​5661] by @​rybon) - Use named import of history module. ([#​5589] by @​RoboBurned) - Hoist dependencies for smaller UMD builds ([#​5720] by @​pshrmn) - Remove aria-current from navLink when inactive ([#​5508] by @​AlmeroSteyn) - Add invariant for missing "to" property on `<Link>` ([#​5792] by @​selbekk) - Use Prettier on the code ([e6f9017] by @​mjackson) - Fix pathless route's match when parent is null ([#​5964] by @​pshrmn) - Use history.createLocation in `<StaticRouter>` ([#​5722] by @​pshrmn) [#​5209]: `https://github.com/ReactTraining/react-router/pull/5209` [#​5489]: `https://github.com/ReactTraining/react-router/pull/5489` [#​5596]: `https://github.com/ReactTraining/react-router/pull/5596` [#​5661]: `https://github.com/ReactTraining/react-router/pull/5661` [#​5589]: `https://github.com/ReactTraining/react-router/pull/5589` [#​5720]: `https://github.com/ReactTraining/react-router/pull/5720` [#​5508]: `https://github.com/ReactTraining/react-router/pull/5508` [#​5792]: `https://github.com/ReactTraining/react-router/pull/5792` [e6f9017]: remix-run/react-router@e6f9017 [#​5964]: `https://github.com/ReactTraining/react-router/pull/5964` [#​5722]: `https://github.com/ReactTraining/react-router/pull/5722` --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com). Co-authored-by: Renovate Bot <[email protected]>
jeresig
pushed a commit
to Khan/react-router
that referenced
this pull request
Aug 29, 2018
This commit adds a descriptive invariant violation error message whenever the consumer does not remember to set the "to" prop.
This was referenced Sep 22, 2018
Open
This was referenced Oct 26, 2018
1 task
1 task
1 task
This was referenced Jan 7, 2019
Closed
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
First off - thanks for creating this. Me, myself and my team - and thousands of other developers across the world - are building incredibly successful apps thanks to your hard work and sexy brains. I hugely appreciate your efforts.
Now, to business.
Whenever you forget to set the
to
property on a<Link />
component, You get the following error message:If I scroll long enough up the error log, you'll see the error from prop types telling me I forgot to set the required
to
prop - but it usually takes me a minute to figure it out. With the rising ofcreate-react-app
- many people will probably not find it for a bit, because they are busy looking through the stack traces in the error overlay (like I was in my screen shot above).This PR adds an invariant check (I'm very open to suggestions about the error message) to ensure it's sent in. If not, the code will throw before it crashes and burns deep down in the
history
package.Thoughts? It's my first time contributing to your code base, so if I screwed up some formatting way of thinking, please accept my apologies.