Skip to content

Commit 7814f72

Browse files
committed
Preps 1.0.0-alpha.2
1 parent 3e5a346 commit 7814f72

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

commonjs/JobProvider.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ var JobProvider = function (_Component) {
5151
var rehydration = _this2.rehydrateState.jobs[id];
5252
delete _this2.rehydrateState.jobs[id];
5353
return rehydration;
54+
},
55+
removeRehydrate: function removeRehydrate(id) {
56+
delete _this2.rehydrateState.jobs[id];
5457
}
5558
}
5659
};
@@ -88,7 +91,8 @@ JobProvider.childContextTypes = {
8891
getNextId: _react.PropTypes.func.isRequired,
8992
register: _react.PropTypes.func.isRequired,
9093
get: _react.PropTypes.func.isRequired,
91-
getRehydrate: _react2.default.PropTypes.func.isRequired
94+
getRehydrate: _react2.default.PropTypes.func.isRequired,
95+
removeRehydrate: _react2.default.PropTypes.func.isRequired
9296
}).isRequired
9397
};
9498
exports.default = JobProvider;

commonjs/withJob.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ function withJob(config) {
109109
if (!this.state.completed) {
110110
this.resolveWork(this.props);
111111
}
112+
113+
if (this.context.jobs && env === 'browser') {
114+
this.context.jobs.removeRehydrate(id);
115+
}
112116
}
113117
}, {
114118
key: 'componentWillUnmount',
@@ -150,7 +154,8 @@ function withJob(config) {
150154
getNextId: _react.PropTypes.func.isRequired,
151155
register: _react.PropTypes.func.isRequired,
152156
get: _react.PropTypes.func.isRequired,
153-
getRehydrate: _react2.default.PropTypes.func.isRequired
157+
getRehydrate: _react2.default.PropTypes.func.isRequired,
158+
removeRehydrate: _react2.default.PropTypes.func.isRequired
154159
})
155160
};
156161

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-jobs",
3-
"version": "1.0.0-alpha.1",
3+
"version": "1.0.0-alpha.2",
44
"description": "Attach asynchronous/synchronous \"jobs\" to your components, with SSR support.",
55
"license": "MIT",
66
"main": "commonjs/index.js",

umd/react-jobs.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ var JobProvider = function (_Component) {
171171
var rehydration = _this2.rehydrateState.jobs[id];
172172
delete _this2.rehydrateState.jobs[id];
173173
return rehydration;
174+
},
175+
removeRehydrate: function removeRehydrate(id) {
176+
delete _this2.rehydrateState.jobs[id];
174177
}
175178
}
176179
};
@@ -208,7 +211,8 @@ JobProvider.childContextTypes = {
208211
getNextId: _react.PropTypes.func.isRequired,
209212
register: _react.PropTypes.func.isRequired,
210213
get: _react.PropTypes.func.isRequired,
211-
getRehydrate: _react2.default.PropTypes.func.isRequired
214+
getRehydrate: _react2.default.PropTypes.func.isRequired,
215+
removeRehydrate: _react2.default.PropTypes.func.isRequired
212216
}).isRequired
213217
};
214218
exports.default = JobProvider;
@@ -329,6 +333,10 @@ function withJob(config) {
329333
if (!this.state.completed) {
330334
this.resolveWork(this.props);
331335
}
336+
337+
if (this.context.jobs && env === 'browser') {
338+
this.context.jobs.removeRehydrate(id);
339+
}
332340
}
333341
}, {
334342
key: 'componentWillUnmount',
@@ -370,7 +378,8 @@ function withJob(config) {
370378
getNextId: _react.PropTypes.func.isRequired,
371379
register: _react.PropTypes.func.isRequired,
372380
get: _react.PropTypes.func.isRequired,
373-
getRehydrate: _react2.default.PropTypes.func.isRequired
381+
getRehydrate: _react2.default.PropTypes.func.isRequired,
382+
removeRehydrate: _react2.default.PropTypes.func.isRequired
374383
})
375384
};
376385

umd/react-jobs.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)