Skip to content

Adds action info to transition #2

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, prevParams: prevParams, prevQuery: prevQuery, prevPath: prevPath });
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, prevParams: prevParams, prevQuery: prevQuery, prevPath: prevPath });
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, prevParams, prevQuery, prevPath });
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