-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Trigger fetching product suggestions data on WC-Admin page views #59726
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
Trigger fetching product suggestions data on WC-Admin page views #59726
Conversation
- This ensures new users will already see suggestions the first time they land on the empty orders screen
Testing GuidelinesHi @mcliwanow @raicem , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
📝 WalkthroughWalkthroughA changelog entry was added for a WooCommerce update that introduces a new check to determine if product suggestions should be fetched when viewing WooCommerce Admin pages. The core logic update registers a new action hook, triggering a suggestions fetch specifically when the WooCommerce admin dashboard is accessed. Changes
Sequence Diagram(s)sequenceDiagram
participant AdminUser as Admin User
participant WP as WordPress
participant WCMS as WC_Marketplace_Suggestions
AdminUser->>WP: Accesses WooCommerce Admin Dashboard
WP->>WCMS: Fires 'current_screen' action
WCMS->>WCMS: maybe_trigger_suggestions_fetch()
WCMS->>WCMS: Checks if current screen is 'woocommerce_page_wc-admin'
alt Suggestions allowed
WCMS->>WCMS: get_suggestions_api_data()
end
Estimated code review effort
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
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 @KokkieH. LGTM and works as expected.
Submission Review Guidelines:
Changes proposed in this Pull Request:
We use an async process to fetch product recommendations shown in the editor and empty orders screen. This process is only triggered once either of those pages are viewed, with the result that a first-time visitor won't see any recommendations.
We're adding a function that triggers just fetching recommendations (without loading all the JS needed for rendering them) on any WC-Admin page view. That way new users will already see recommendations the first time they visit the screens where those are displayed.
Closes WCCOM-1618
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
cd plugins/woocommerce
and runpnpm watch:build
pnpm env:start
pnpm -- wp-env run cli wp option delete woocommerce_marketplace_suggestions
Testing that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Check if product suggestions should be fetched whenever someone views a WC Admin page.
Changelog Entry Comment
Comment