-
Notifications
You must be signed in to change notification settings - Fork 32
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
PCH: Enhance Request Handling in Provider Classes #2401
Conversation
WalkthroughWalkthroughThe recent updates primarily focus on refining JSDoc comments across various files for better consistency and readability. Additionally, there are significant changes in the management of provider classes, transitioning to singleton patterns for better resource handling. Error handling and API interaction methods have also been improved in specific components. Changes
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
# Conflicts: # build/content-helper/dashboard-widget.asset.php # build/content-helper/editor-sidebar.asset.php
@coderabbitai review |
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.
Thank you for your work and for the great PR description!
Approving with a minor comment.
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 15.0.2 to 15.0.4. - [Release notes](https://github.com/testing-library/react-testing-library/releases) - [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md) - [Commits](testing-library/react-testing-library@v15.0.2...v15.0.4) --- updated-dependencies: - dependency-name: "@testing-library/react" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
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.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
src/content-helper/excerpt-generator/components/excerpt-panel.tsx (1)
Line range hint
1-1
: Ensure the file includes a@since
tag for the next version of the plugin in the JSDoc comments.
src/content-helper/editor-sidebar/title-suggestions/provider.ts
Outdated
Show resolved
Hide resolved
@acicovic the merge mess should be fixed! Not sure what happened there :D I took a look at the change set, and it looks alright. But just in case, feel free to take another look and let me know if I have 🟢 to merge! |
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 it's OK now.
Description
This PR refactors all provider classes to inherit from a newly introduced
BaseProvider
. This new base class equips each provider with an enhanced method for fetching data from the API that includes support for cancelling ongoing requests using theAbortController
.This update transitions provider methods from static to instance methods, which allows each provider to maintain its own map of
AbortController
instances, one per request. This architecture ensures that cancelling one request does not inadvertently cancel others. While not currently implemented, this setup facilitates future enhancements, such as assigning unique abort IDs for selectively cancelling requests in complex operations like smart linking across multiple paragraphs.This architecture not only simplifies the management of request cancellations but also positions the codebase for more sophisticated request handling scenarios in the future.
Motivation and Context
How has this been tested?
Each provider was tested individually through manual checks, end-to-end tests, and unit tests with Jest.
Summary by CodeRabbit
New Features
Bug Fixes
isDismissible
property from certain UI components to streamline user notifications.Documentation
Refactor
Chores