Skip to content

Commit

Permalink
fix: context is null
Browse files Browse the repository at this point in the history
  • Loading branch information
windyGex committed Dec 31, 2020
1 parent a4d7fed commit 9cb0165
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/connect.jsx
Expand Up @@ -52,8 +52,8 @@ const connect = function (mapStateToProps = state => state, config = {}) {
this._deps = {};
this._change = change.bind(this);
this._get = get.bind(this);
this.store = context.store || Store.get();
if (config.inject) {
this.store = context && context.store || Store.get();
if (config.inject && context) {
if (context.injectStore) {
this.store = context.injectStore;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/inject.jsx
Expand Up @@ -50,7 +50,7 @@ const inject = function (key, value) {
this[key].on('change', this._change);
this[key].history = this[key].history || this.props.history;
if (this[key].name) {
this.context.store && this.context.store.mount(this[key].name, this[key]);
this.context && this.context.store && this.context.store.mount(this[key].name, this[key]);
}
if (!Component.prototype._hasSet) {
Object.defineProperty(Component.prototype, key, {
Expand Down

0 comments on commit 9cb0165

Please sign in to comment.