Skip to content
Merged
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
13 changes: 1 addition & 12 deletions src/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ export default ({scope, ...defaultProps} = {}) => (WrappedComponent) => {
router: PropTypes.object,
}

navigateToPath(path) {
// Check for the react-router context.
if (!this.context.router) {
return;
}

this.context.router.push(path);
}

render() {
const {components, renderMap} = this.props.___relocationState___;
const {
Expand All @@ -56,9 +47,7 @@ export default ({scope, ...defaultProps} = {}) => (WrappedComponent) => {
...component,
render: renderMap[component.type],
update: (props) => updateComponent(component.id, props),
remove: typeof component.removePath === 'string'
? () => this.navigateToPath(component.removePath)
: () => removeComponent(component.id),
remove: () => removeComponent(component.id),
};

if (scope) {
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ export {ADD_COMPONENT, REMOVE_COMPONENT} from './action';
export {addComponent, removeComponent} from './action';
export {default as relocation} from './connect';
export {default as reducer} from './reducer';
export {default as createRelocationRouter} from './router';
export {default} from './connect';
6 changes: 0 additions & 6 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
SET_COMPONENT,
UPDATE_COMPONENT,
REMOVE_COMPONENT,
SET_ROUTE_COMPONENTS,
} from './action';

export default combineReducers({
Expand All @@ -25,9 +24,4 @@ export default combineReducers({
state.filter((item) => item.id !== payload.id),

}[action.type] || (() => state))(state, action),

routeComponents: (state = [], action) =>
action.type === SET_ROUTE_COMPONENTS
? action.payload
: state,
});
111 changes: 0 additions & 111 deletions src/router.js

This file was deleted.

13 changes: 2 additions & 11 deletions src/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,5 @@ export const getRelocation = (state, props) =>
? props.getRelocationState(state, props)
: state.relocation;

export const getComponents = (state, props) => {
const routeComponents = getRelocation(state, props).routeComponents;
const components = getRelocation(state, props).components;

// Concat components and route components uniquely by id.
return routeComponents
.filter(({id: routeId}) =>
!components.filter(({id}) => id === routeId).length
)
.concat(components);
};
export const getComponents = (state, props) =>
getRelocation(state, props).components;
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const componentShape = PropTypes.shape({
scope: PropTypes.string,
props: PropTypes.object,
remove: PropTypes.func,
removePath: PropTypes.string,
update: PropTypes.func,
render: renderShape,
});

Expand Down