-
Notifications
You must be signed in to change notification settings - Fork 930
Disable httpHeadersOverwriteParam for ReactNative to address #703. #717
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
Disable httpHeadersOverwriteParam for ReactNative to address #703. #717
Conversation
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.
Idea seems basically sane but I can't say I understand what we're doing and why.
Some thoughts that might help clear this up:
- Which headers are we setting that trigger CORS preflight?
- What exactly does setting
httpHeadersOverwriteParam
do?
packages/firestore/src/util/misc.ts
Outdated
/** | ||
* Detects whether we are running in a React Native app. | ||
*/ | ||
export function isReactNative(): boolean { |
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.
Could we put this in a platform-detection module?
Maybe even combined with our browser version detection stuff?
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.
So looking to see what platform detection code already existed I discovered that, uh, this exact function already exists as a Firebase-wide helper in
export const isReactNative = function() { |
I didn't clean up our other browser-detection code, but I added a TODO (cc/ @schmidt-sebastian since the multi-tab work is changing / adding additional browser detection logic I believe).
// preflight round-trip. This is formally defined here: | ||
// https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L40 | ||
// | ||
// For some unclear reason (see |
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.
At a high level I understand what this comment is saying but I don't understand mechanically how this is actually working.
When we specify httpHeadersOverwriteParam: '$httpHeaders'
, which headers are getting tucked into that variable? If we omit setting that, where do they get set instead?
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.
Expanded to hopefully be clearer. Thanks for flagging.
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.
Thanks! PTAL.
// preflight round-trip. This is formally defined here: | ||
// https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L40 | ||
// | ||
// For some unclear reason (see |
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.
Expanded to hopefully be clearer. Thanks for flagging.
packages/firestore/src/util/misc.ts
Outdated
/** | ||
* Detects whether we are running in a React Native app. | ||
*/ | ||
export function isReactNative(): boolean { |
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.
So looking to see what platform detection code already existed I discovered that, uh, this exact function already exists as a Firebase-wide helper in
export const isReactNative = function() { |
I didn't clean up our other browser-detection code, but I added a TODO (cc/ @schmidt-sebastian since the multi-tab work is changing / adding additional browser detection logic I believe).
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.
LGTM
No description provided.