Skip to content

Commit

Permalink
Preps 1.0.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlplusb committed Apr 5, 2017
1 parent 3e5a346 commit 7814f72
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
6 changes: 5 additions & 1 deletion commonjs/JobProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ var JobProvider = function (_Component) {
var rehydration = _this2.rehydrateState.jobs[id];
delete _this2.rehydrateState.jobs[id];
return rehydration;
},
removeRehydrate: function removeRehydrate(id) {
delete _this2.rehydrateState.jobs[id];
}
}
};
Expand Down Expand Up @@ -88,7 +91,8 @@ JobProvider.childContextTypes = {
getNextId: _react.PropTypes.func.isRequired,
register: _react.PropTypes.func.isRequired,
get: _react.PropTypes.func.isRequired,
getRehydrate: _react2.default.PropTypes.func.isRequired
getRehydrate: _react2.default.PropTypes.func.isRequired,
removeRehydrate: _react2.default.PropTypes.func.isRequired
}).isRequired
};
exports.default = JobProvider;
7 changes: 6 additions & 1 deletion commonjs/withJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function withJob(config) {
if (!this.state.completed) {
this.resolveWork(this.props);
}

if (this.context.jobs && env === 'browser') {
this.context.jobs.removeRehydrate(id);
}
}
}, {
key: 'componentWillUnmount',
Expand Down Expand Up @@ -150,7 +154,8 @@ function withJob(config) {
getNextId: _react.PropTypes.func.isRequired,
register: _react.PropTypes.func.isRequired,
get: _react.PropTypes.func.isRequired,
getRehydrate: _react2.default.PropTypes.func.isRequired
getRehydrate: _react2.default.PropTypes.func.isRequired,
removeRehydrate: _react2.default.PropTypes.func.isRequired
})
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-jobs",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.2",
"description": "Attach asynchronous/synchronous \"jobs\" to your components, with SSR support.",
"license": "MIT",
"main": "commonjs/index.js",
Expand Down
13 changes: 11 additions & 2 deletions umd/react-jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ var JobProvider = function (_Component) {
var rehydration = _this2.rehydrateState.jobs[id];
delete _this2.rehydrateState.jobs[id];
return rehydration;
},
removeRehydrate: function removeRehydrate(id) {
delete _this2.rehydrateState.jobs[id];
}
}
};
Expand Down Expand Up @@ -208,7 +211,8 @@ JobProvider.childContextTypes = {
getNextId: _react.PropTypes.func.isRequired,
register: _react.PropTypes.func.isRequired,
get: _react.PropTypes.func.isRequired,
getRehydrate: _react2.default.PropTypes.func.isRequired
getRehydrate: _react2.default.PropTypes.func.isRequired,
removeRehydrate: _react2.default.PropTypes.func.isRequired
}).isRequired
};
exports.default = JobProvider;
Expand Down Expand Up @@ -329,6 +333,10 @@ function withJob(config) {
if (!this.state.completed) {
this.resolveWork(this.props);
}

if (this.context.jobs && env === 'browser') {
this.context.jobs.removeRehydrate(id);
}
}
}, {
key: 'componentWillUnmount',
Expand Down Expand Up @@ -370,7 +378,8 @@ function withJob(config) {
getNextId: _react.PropTypes.func.isRequired,
register: _react.PropTypes.func.isRequired,
get: _react.PropTypes.func.isRequired,
getRehydrate: _react2.default.PropTypes.func.isRequired
getRehydrate: _react2.default.PropTypes.func.isRequired,
removeRehydrate: _react2.default.PropTypes.func.isRequired
})
};

Expand Down
2 changes: 1 addition & 1 deletion umd/react-jobs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7814f72

Please sign in to comment.