|
1 | 1 | var React = require('react');
|
2 | 2 | var warning = require('react/lib/warning');
|
3 | 3 | var invariant = require('react/lib/invariant');
|
4 |
| -var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; |
5 | 4 | var copyProperties = require('react/lib/copyProperties');
|
6 | 5 | var HashLocation = require('../locations/HashLocation');
|
7 | 6 | var reversedArray = require('../utils/reversedArray');
|
@@ -261,36 +260,6 @@ function computeHandlerProps(matches, query) {
|
261 | 260 | return props;
|
262 | 261 | }
|
263 | 262 |
|
264 |
| -var BrowserTransitionHandling = { |
265 |
| - |
266 |
| - handleError: function (component, error) { |
267 |
| - throw error; // This error probably originated in a transition hook. |
268 |
| - }, |
269 |
| - |
270 |
| - handleAbort: function (component, reason) { |
271 |
| - if (reason instanceof Redirect) { |
272 |
| - component.replaceWith(reason.to, reason.params, reason.query); |
273 |
| - } else { |
274 |
| - component.goBack(); |
275 |
| - } |
276 |
| - } |
277 |
| - |
278 |
| -}; |
279 |
| - |
280 |
| -var ServerTransitionHandling = { |
281 |
| - |
282 |
| - handleError: function (component, error) { |
283 |
| - // TODO |
284 |
| - }, |
285 |
| - |
286 |
| - handleAbort: function (component, reason) { |
287 |
| - // TODO |
288 |
| - } |
289 |
| - |
290 |
| -}; |
291 |
| - |
292 |
| -var TransitionHandling = canUseDOM ? BrowserTransitionHandling : ServerTransitionHandling; |
293 |
| - |
294 | 263 | var ActiveContext = require('../mixins/ActiveContext');
|
295 | 264 | var LocationContext = require('../mixins/LocationContext');
|
296 | 265 | var RouteContext = require('../mixins/RouteContext');
|
@@ -348,9 +317,12 @@ var Routes = React.createClass({
|
348 | 317 |
|
349 | 318 | this.dispatch(path, actionType, function (error, abortReason) {
|
350 | 319 | if (error) {
|
351 |
| - TransitionHandling.handleError(this, error); |
| 320 | + // Throw so we don't silently swallow errors. |
| 321 | + throw error; // This error probably originated in a transition hook. |
| 322 | + } else if (abortReason instanceof Redirect) { |
| 323 | + this.replaceWith(abortReason.to, abortReason.params, abortReason.query); |
352 | 324 | } else if (abortReason) {
|
353 |
| - TransitionHandling.handleAbort(this, abortReason); |
| 325 | + this.goBack(); |
354 | 326 | } else {
|
355 | 327 | this.updateScroll(path, actionType);
|
356 | 328 |
|
|
0 commit comments