Skip to content

Commit f43ba49

Browse files
committed
add built-in $reset action
Description: - add an integrated `$reset` action that will reset the state at connector's namespace to connector's initial state - also, remove 'displayName' static getter, since connectors have explicit names
1 parent d374104 commit f43ba49

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/components/Connector.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export default class Connector extends Component {
1414
this.__generateDispatchers(actionNames);
1515

1616
return function(state = initialState, action) {
17+
if (action.type === `${namespace}/$reset`) {
18+
return initialState;
19+
}
20+
1721
const [actionNamespace, actionType] = action.type.split('/');
1822

1923
if (actionNamespace === namespace) {
@@ -43,12 +47,6 @@ export default class Connector extends Component {
4347
return `${this.$namespace}/${name}`;
4448
}
4549

46-
static get displayName() {
47-
const viewName = this.$connection.displayName || this.$connection.name || 'Component';
48-
49-
return `Connector(${viewName})`;
50-
}
51-
5250
static contextTypes = {
5351
store: storeShape
5452
};

0 commit comments

Comments
 (0)