raven-for-redux
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -20,13 +20,12 @@ "use strict"; | ||
Raven.setDataCallback(function (data, original) { | ||
data.extra.lastAction = actionTransformer(data.extra.lastAction); | ||
data.extra.state = stateTransformer(data.extra.state); | ||
return original ? original(data) : data; | ||
}); | ||
return function (store) { | ||
// Record the initial state in case we crash before the first action | ||
// succeeds. | ||
// TODO: This does not currently work. | ||
Raven.setExtraContext({ state: store.getState() }); | ||
var lastAction = void 0; | ||
Raven.setDataCallback(function (data, original) { | ||
data.extra.lastAction = actionTransformer(lastAction); | ||
data.extra.state = stateTransformer(store.getState()); | ||
return original ? original(data) : data; | ||
}); | ||
return function (next) { | ||
@@ -42,15 +41,4 @@ return function (action) { | ||
// Set the action as context in case we crash in the reducer. | ||
var extra = { lastAction: action }; | ||
var returnValue = Raven.context({ extra: extra }, function () { | ||
return next(action); | ||
}); | ||
// Set the last action and state as context in case we crash before | ||
// the next action is dispatched. | ||
Raven.setExtraContext({ | ||
lastAction: action, | ||
state: store.getState() | ||
}); | ||
return returnValue; | ||
lastAction = action; | ||
return next(action); | ||
}; | ||
@@ -57,0 +45,0 @@ }; |
{ | ||
"name": "raven-for-redux", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "Middleware for propagating Redux state/actions to Sentry via Raven.", | ||
@@ -51,2 +51,2 @@ "main": "built/index.js", | ||
} | ||
} | ||
} |
@@ -125,9 +125,13 @@ [![Travis](https://img.shields.io/travis/captbaritone/raven-for-redux.svg)]() [![Codecov](https://img.shields.io/codecov/c/github/captbaritone/raven-for-redux.svg)]() | ||
### 0.7.1 | ||
* Refactor: Use implicit binding to track the state/last action. ([1def9a7]) | ||
### 0.7.0 | ||
* Return the previous middleware's (or the actual `dispatch` function's) return value. (#11) | ||
* Return the next middleware's (or the actual `dispatch` function's) return value. ([#11]) | ||
### 0.6.0 | ||
* `actionTransformeri` and `stateTransformer` are only run when reporting an error, rather than on every action. (#8) | ||
* `actionTransformeri` and `stateTransformer` are only run when reporting an error, rather than on every action. ([#8]) | ||
@@ -140,1 +144,4 @@ | ||
[`dataCallback`]: https://docs.sentry.io/clients/javascript/config/ | ||
[#11]: https://github.com/captbaritone/raven-for-redux/pull/11 | ||
[#8]: https://github.com/captbaritone/raven-for-redux/pull/8 | ||
[1def9a7]: https://github.com/captbaritone/raven-for-redux/commit/1def9a747d7b711ad93da531b8ff9d128c352b45 |
146
8339
38