-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Use fetch instead of XHR for forwarding stats uploads #904
refactor: Use fetch instead of XHR for forwarding stats uploads #904
Conversation
src/apiClient.ts
Outdated
mid: number; | ||
esid: number; | ||
n: string; | ||
attrs: Dictionary<any>; |
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 avoid using any
. Either we should make a type for this attribute, or use Record<string, string>
if it's a simple key/value pair. I would prefer the former if there are a specific attributes that must be passed.
src/apiClient.ts
Outdated
this.sendSingleForwardingStatsToServer = async ( | ||
forwardingStatsData: IForwardingStatsData | ||
) => { |
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.
this.sendSingleForwardingStatsToServer = async ( | |
forwardingStatsData: IForwardingStatsData | |
) => { | |
this.sendSingleForwardingStatsToServer = async ( | |
forwardingStatsData: IForwardingStatsData | |
): void => { |
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 ended up moving this to the forwarder.js file, so we lost the typing here. it seemed to fit better there logically, but i can revert if you think keeping the types is more important than organization
Co-authored-by: Alex S <49695018+alexs-mparticle@users.noreply.github.com>
Quality Gate failedFailed conditions |
Instructions
development
Summary
This PR prioritizes using
fetch
in when sending forwarding stats to mParticle servers. XHR is used as a fallback.Testing Plan
window.fetch
in order to test XHR fallback.Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)