-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
π Enhance Pull-to-Refresh Functionality with Native Sync and Improvements π #48632
Conversation
// $FlowFixMe[incompatible-type] asserted above | ||
// $FlowFixMe[unsafe-addition] | ||
const constants = NativeBlobModule.getConstants(); |
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.
Why was this moved?
I understand that $FlowFixMe
directives were related to the line below?
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
@@ -76,7 +73,6 @@ export class URL { | |||
// Do nothing. | |||
} | |||
|
|||
// $FlowFixMe[missing-local-annot] |
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.
Why was this removed?
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
@@ -104,51 +100,54 @@ export class URL { | |||
} | |||
this._url = `${baseUrl}${url}`; | |||
} | |||
|
|||
// Parsing the URL to use for accessors | |||
this._parsedUrl = new globalThis.URL(this._url); |
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.
Why globalThis
here?
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.
Also, can this be done lazily, to avoid parsing if the accessors are not ever used?
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
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.
β¨ What's New?
- Lazy Parsing Optimization: Implemented a
_parseUrlIfNeeded
method to defer parsing of URLs until required. This reduces unnecessary overhead, improving performance for cases where URL accessors aren't used. ππ¨ - Improved Compatibility: Enhanced fallback for
globalThis
by including support forwindow
, ensuring seamless usage across diverse environments. ππ
π‘ Why It Matters?
These changes optimize the URL module for better efficiency and flexibility, especially in resource-constrained or varied runtime scenarios. By introducing lazy parsing, we're ensuring that operations are performed only when needed, aligning with performance best practices. β‘π οΈ
π Impact:
- Boosts performance π
- Ensures compatibility in broader environments π₯οΈπ±
Thanks for reviewing! Let me know if there's anything else you'd like improved. π
// $FlowFixMe[incompatible-type] asserted above | ||
// $FlowFixMe[unsafe-addition] | ||
const constants = NativeBlobModule.getConstants(); |
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
@@ -76,7 +73,6 @@ export class URL { | |||
// Do nothing. | |||
} | |||
|
|||
// $FlowFixMe[missing-local-annot] |
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
@@ -104,51 +100,54 @@ export class URL { | |||
} | |||
this._url = `${baseUrl}${url}`; | |||
} | |||
|
|||
// Parsing the URL to use for accessors | |||
this._parsedUrl = new globalThis.URL(this._url); |
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
@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@krishpranav The test_js and lint jobs on CI are broken. Could you please fix those? Thanks. |
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.
Please do fix the broken test jobs on CI.
@krishpranav Another thing to note is that neither title, nor description of this PR has anything to do with what it actually does. Can you elaborate here? |
This PR's description does not match its content. |
Summary:
β¨ Enhancing the Pull-to-Refresh Functionality:
This pull request optimizes the refresh control behavior for both iOS and Android platforms. It resolves synchronization issues between the JS and native components, ensuring smoother and faster pull-to-refresh experiences. The update addresses UI feedback and performance improvements, making the feature more responsive and reliable. π
Changelog:
Test Plan:
Issue Tagging: