Skip to content

Commit

Permalink
Adds action info to transition
Browse files Browse the repository at this point in the history
  • Loading branch information
jwickens committed Jun 9, 2021
1 parent 44ec859 commit 9a6fa88
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions build/lib/Transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ var Redirect = require('./Redirect');
* an instance of this class as their first argument.
*/
function Transition(path, retry) {
var meta = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];

this.path = path;
this.abortReason = null;
this.meta = meta;
// TODO: Change this to router.retryTransition(transition)
this.retry = retry.bind(this);
}
Expand Down
2 changes: 1 addition & 1 deletion build/lib/createRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function createRouter(options) {
toRoutes = nextRoutes;
}

var transition = new Transition(path, Router.replaceWith.bind(Router, path));
var transition = new Transition(path, Router.replaceWith.bind(Router, path), { action: action, prevRoutes: prevRoutes, prevPrams: prevPrams, prevQuery: prevQuery });
pendingTransition = transition;

var fromComponents = mountedComponents.slice(prevRoutes.length - fromRoutes.length);
Expand Down
2 changes: 1 addition & 1 deletion build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router",
"version": "0.13.5",
"version": "0.13.6",
"description": "A complete routing library for React.js",
"main": "lib",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion build/umd/ReactRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2737,7 +2737,7 @@ return /******/ (function(modules) { // webpackBootstrap
toRoutes = nextRoutes;
}

var transition = new Transition(path, Router.replaceWith.bind(Router, path));
var transition = new Transition(path, Router.replaceWith.bind(Router, path), { action: action, prevRoutes: prevRoutes, prevPrams: prevPrams, prevQuery: prevQuery });
pendingTransition = transition;

var fromComponents = mountedComponents.slice(prevRoutes.length - fromRoutes.length);
Expand Down Expand Up @@ -3052,8 +3052,11 @@ return /******/ (function(modules) { // webpackBootstrap
* an instance of this class as their first argument.
*/
function Transition(path, retry) {
var meta = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];

this.path = path;
this.abortReason = null;
this.meta = meta;
// TODO: Change this to router.retryTransition(transition)
this.retry = retry.bind(this);
}
Expand Down
6 changes: 3 additions & 3 deletions build/umd/ReactRouter.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion modules/Transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ var Redirect = require('./Redirect');
* The willTransitionTo and willTransitionFrom handlers receive
* an instance of this class as their first argument.
*/
function Transition(path, retry) {
function Transition(path, retry, meta = null) {
this.path = path;
this.abortReason = null;
this.meta = meta;
// TODO: Change this to router.retryTransition(transition)
this.retry = retry.bind(this);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/createRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ function createRouter(options) {
toRoutes = nextRoutes;
}

var transition = new Transition(path, Router.replaceWith.bind(Router, path));
var transition = new Transition(path, Router.replaceWith.bind(Router, path), { action, prevRoutes, prevPrams, prevQuery });
pendingTransition = transition;

var fromComponents = mountedComponents.slice(prevRoutes.length - fromRoutes.length);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router",
"version": "0.13.5",
"version": "0.13.6",
"description": "A complete routing library for React.js",
"main": "build/lib",
"repository": {
Expand Down

0 comments on commit 9a6fa88

Please sign in to comment.