-
Notifications
You must be signed in to change notification settings - Fork 85
Add dest mw take two #150
Add dest mw take two #150
Conversation
This bug meant that this code did not send an event with a userId=bar to segment.io. This change will result in this code sending an event with userId=bar to segment.io: f=function(payload, integration, next) { payload.obj.userId = "bar";next(payload); }; analytics.addIntegrationMiddleware(f); analytics.identify();
self._destinationMiddlewares[integration.name].applyMiddlewares( | ||
facadeCopy, | ||
integration.name, | ||
function(result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way, using JSDocs, document the format we expect result
to respect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you would need to do one line per property like this https://jsdoc.app/tags-param.html#parameters-with-properties
The code and PR documentation look good to me - will defer the final +1 to someone with more context! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix two comments, otherwise looks good to me.
HISTORY.md
Outdated
@@ -1,3 +1,6 @@ | |||
- Revert "Add destination mw (#148)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the "Revert" line, since it will be i the release log, and confuses people
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved by fccfece
test/analytics.test.js
Outdated
@@ -495,7 +495,7 @@ describe('Analytics', function() { | |||
}); | |||
|
|||
it('should emit "invoke" with facade', function(done) { | |||
var opts = { All: false }; | |||
var opts = { All: true }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we revert this change? I wonder if we need this change even after fixing the emitter
issue. Want to make sure all of the old tests are green without any modification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved by fccfece
This PR adds destination middleware support. This feature was originally released to master but was then reverted as a regression was discovered. That regression was addressed by this commit ( 010219b ) and we are re-releasing.
Verification
Testing completed successfully on local and staging. Run this code in the console of a project connected to a mixpanel destination and then observe the identify event in mixpanel with user id foobarcat
See:
https://www.dropbox.com/s/ncrbwm3tkvphhzf/Screen%20Recording%202020-05-21%20at%202.26.55%20PM.mov?dl=0
Checklist
Please ensure the following are completed to help get your PR merged:
Respect earns Respect 👏
Please respect our Code of Conduct, in short: