Skip to content
Closed
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
10 changes: 7 additions & 3 deletions modules/RouterContextMixin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import invariant from 'invariant';
import { stripLeadingSlashes, stringifyQuery } from './URLUtils';
import { stripLeadingSlashes, stringifyQuery, parseQueryString } from './URLUtils';

var { func, object } = React.PropTypes;

Expand All @@ -22,6 +22,10 @@ function queryIsActive(query, activeQuery) {
if (query == null)
return true;

if (typeof query === 'string') {
query = parseQueryString(query);
}

for (var p in query)
if (query.hasOwnProperty(p) && String(query[p]) !== String(activeQuery[p]))
return false;
Expand Down Expand Up @@ -73,7 +77,7 @@ var RouterContextMixin = {
makeHref(pathname, query) {
return this.makePath(pathname, query);
},

/**
* Pushes a new Location onto the history stack.
*/
Expand Down Expand Up @@ -131,7 +135,7 @@ var RouterContextMixin = {
goForward() {
this.go(1);
},

/**
* Returns true if a <Link> to the given pathname/query combination is
* currently active.
Expand Down