Skip to content
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
2 changes: 0 additions & 2 deletions src/components/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ class BaseRouterComponent extends PureComponent {
}

componentWillUnmount() {

if (this.isSubscribed) {
this.unsubscribe();
delete this.unsubscribe;
}
}

get isSubscribed() {

return typeof this.unsubscribe === 'function';
}

Expand Down
5 changes: 0 additions & 5 deletions src/components/Fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { push as actionPush } from '../actions';
class Fragment extends BaseRouterComponent {

constructor(props, context) {

super(props, context);

const { id } = this.props;
Expand All @@ -19,7 +18,6 @@ class Fragment extends BaseRouterComponent {
}

componentWillReceiveProps(newProps) {

const { redirect } = this.props;
const newRedirect = newProps.redirect;

Expand All @@ -31,14 +29,12 @@ class Fragment extends BaseRouterComponent {
}

getChildContext() {

const { router } = this.context;

return { router: { ...router, current: this.current } };
}

handleStoreChange(newProps) {

if (!this.isSubscribed) return;

const routerStore = this.getStatefromStore();
Expand Down Expand Up @@ -77,7 +73,6 @@ class Fragment extends BaseRouterComponent {
}

render() {

const { visible, matchExact, redirect } = this.state;
const { children, component: ChildComponent} = this.props;

Expand Down
7 changes: 0 additions & 7 deletions src/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {


const compareQueryItems = (linkQueryItem, routeQueryItem) => {

linkQueryItem = [].concat(linkQueryItem);
routeQueryItem = [].concat(routeQueryItem);

Expand All @@ -28,7 +27,6 @@ const compareQueryItems = (linkQueryItem, routeQueryItem) => {
};

function filterProps(props) {

const propsCopy = Object.assign({}, props);

const managedProps = [ 'to', 'activeClass', 'method', 'activeMatch' ];
Expand All @@ -43,7 +41,6 @@ function filterProps(props) {
class Link extends BaseRouterComponent {

constructor(props, context) {

super(props, context);

this.handleClick = this.handleClick.bind(this);
Expand All @@ -55,7 +52,6 @@ class Link extends BaseRouterComponent {
}

componentWillReceiveProps(newProps) {

if (this.props.to !== newProps.to) {
this.href = this.getHref(newProps);
}
Expand All @@ -71,7 +67,6 @@ class Link extends BaseRouterComponent {
}

handleClick(e) {

const { onClick } = this.props;

if (typeof onClick === 'function') {
Expand Down Expand Up @@ -107,7 +102,6 @@ class Link extends BaseRouterComponent {
}

handleStoreChange() {

if (!this.isSubscribed) return;

const { activeClass, activeMatch } = this.props;
Expand Down Expand Up @@ -166,7 +160,6 @@ class Link extends BaseRouterComponent {
}

render() {

const { children, activeClass, className, target = null } = this.props;
const classes = this.state.isActive ? `${className} ${activeClass}` : className;

Expand Down
1 change: 0 additions & 1 deletion src/components/Provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { DEFAULT_SLICE, __DEV__ } from '../constants';

class Provider extends Component {
getChildContext() {

const { immutable, slice, routes, current } = this.props;
const router = {
immutable,
Expand Down
1 change: 0 additions & 1 deletion src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ACTION_PREFIX, ACTION_TYPES, HISTORY_METHODS} from './constants';
import { parsePath } from 'history';

export default ({ history, routeParser }) => ({ dispatch, getState }) => next => action => {

if (action.type.indexOf(ACTION_PREFIX) === 0 && action.type !== ACTION_TYPES.LOCATION_CHANGED) {

if (action.type === ACTION_TYPES.GO_TO_ROUTE) {
Expand Down
1 change: 0 additions & 1 deletion src/parsers/locationToRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const createParamsFromKeys = (match, keys) => keys.reduce((result, key, index) =
}, {});

const createMatchPathToRoute = matchers => path => {

path = path.split('?');
const pathname = path.shift();
const pathQuery = qs.parse(path.shift());
Expand Down
1 change: 0 additions & 1 deletion src/parsers/routeToLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const createMatchRouteToPath = registry => ({ id, params = {}, query = {}, hash
};

const createRouteToLocationParser = routes => {

const registry = flattenRoutes(routes).reduce((result, item) => {
if (result[item.id]) {
return result;
Expand Down
1 change: 0 additions & 1 deletion src/parsers/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { join as pathJoin } from 'path';
import { __DEV__, ID_DELIM } from '../constants';

export const flattenRoutes = (routes, parentRoutePath = '', parentIdPath = '', parentData = {}) => {

let result = [];

for (let route of routes) {
Expand Down
1 change: 0 additions & 1 deletion src/reducer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ACTION_TYPES } from './constants';

export default ({ locationParser, immutable }) => (state = immutable ? require('immutable').fromJS({}) : {}, { type, payload }) => {

if (type === ACTION_TYPES.LOCATION_CHANGED) {

const result = locationParser(payload);
Expand Down
1 change: 0 additions & 1 deletion src/store-enhancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const scrollToHash = hash => {
};

export default ({ history, slice, locationParser, immutable }) => next => (reducer, initialState, enhancer) => {

// boilerplate
if (typeof initialState === 'function' && typeof enhancer === 'undefined') {
enhancer = initialState;
Expand Down