-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Do not display Install/Connect button for SaaS products #61797
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
base: trunk
Are you sure you want to change the base?
Do not display Install/Connect button for SaaS products #61797
Conversation
…mmerce, woocommerce/client/admin
|
Claude finished @KokkieH's task —— View job Backwards Compatibility Review ✅SummaryRisk Level: None This PR introduces a new optional property Rationale:
Detailed AnalysisTypeScript Interface ChangesFile: Added property: has_changelog: boolean;BC Assessment: ✅ Safe
Conditional Rendering Logic ChangesFile: Before: } else if (
subscription.local.installed === false &&
subscription.subscription_installed === false
) {
actionButton = <Install subscription={ subscription } />;
} else if (
subscription.active === false &&
subscription.subscription_available === true
) {
actionButton = <ConnectButton subscription={ subscription } variant="link" />;
}After: } else if (
subscription.local.installed === false &&
subscription.subscription_installed === false &&
subscription.has_changelog === true
) {
actionButton = <Install subscription={ subscription } />;
} else if (
subscription.active === false &&
subscription.subscription_available === true &&
subscription.has_changelog === true
) {
actionButton = <ConnectButton subscription={ subscription } variant="link" />;
}BC Assessment: ✅ Safe - Defensive Implementation
Data Flow AnalysisThe
BC Assessment: ✅ Safe
Ecosystem Impact AssessmentPayment Gateways: ✅ No impact
WooCommerce Extensions (Subscriptions/Bookings/Memberships): ✅ No impact
Themes Customizing Templates: ✅ No impact
Custom Checkout Flows: ✅ No impact
Third-party Code Consuming Marketplace Data:
Testing FocusPrimary Test Area: Marketplace My Subscriptions page ( Regression Testing Steps:
Expected Behavior:
Confidence95% - High confidence in no breaking changes Justification:
Migration/Deprecation GuidanceNone required - This is a purely additive change with no deprecations. For Extension Developers: No action needed. If you have custom code that:
ConclusionNo breaking changes detected. This PR safely hides Install/Connect buttons for SaaS products that don't have downloadable files, improving the user experience by removing non-functional UI elements. The implementation is defensive, backwards-compatible, and properly coordinated with backend changes. |
📝 WalkthroughWalkthroughThis pull request adds a conditional guard to prevent displaying the Install and ConnectButton actions for marketplace subscriptions without a changelog. A new boolean field Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
Size Change: +16 B (0%) Total Size: 6.03 MB |
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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx (1)
395-402: Guard against undefinedhas_changelogfor backwards compatibility.Same issue as the Install button above: the strict equality check
subscription.has_changelog === truemay break existing ConnectButton functionality if the API doesn't providehas_changelogfor all subscriptions.Apply similar defensive coding as suggested for the Install button:
} else if ( subscription.active === false && subscription.subscription_available === true && - subscription.has_changelog === true + ( subscription.has_changelog ?? true ) === true ) {Based on coding guidelines
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
plugins/woocommerce/changelog/61797-update-WCCOM-1896-hide-install-button-for-saas-products(1 hunks)plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx(1 hunks)plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/types.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{php,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-quality.mdc)
**/*.{php,js,jsx,ts,tsx}: Guard against unexpected inputs
Sanitize and validate any potentially dangerous inputs
Ensure code is backwards compatible
Write code that is readable and intuitive
Ensure code has unit or E2E tests where applicable
Files:
plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/types.tsplugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx
**/*.{php,js,jsx,tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/avoid-regex.mdc)
**/*.{php,js,jsx,tsx,ts}: Avoid using regular expressions unless absolutely necessary to favor readability and maintainability
Only consider regex when no built-in language alternative (string/array APIs) fits the need
Only use regex when performance is critical and faster than alternatives, with measurements to justify
Use regex for complex pattern matching only if the pattern is well-documented and thoroughly tested
Allow regex when maintaining legacy code where an existing, correct pattern is being modified
If regex is necessary, document the pattern extensively to explain what it matches
If regex is necessary, add comprehensive tests covering edge cases and potential security issues
Use named capture groups in regex to improve readability when supported
Validate input before applying regex to ensure it is safe
Assess and mitigate security risks when using regex, including ReDoS and injection vulnerabilities
Avoid regex patterns that can cause catastrophic backtracking (ReDoS)
Do not construct regex from untrusted input to prevent injection attacks
Ensure regex patterns do not overmatch and unintentionally capture unexpected inputs
Files:
plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/types.tsplugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx
**/*.{php,js,ts,jsx,tsx}
⚙️ CodeRabbit configuration file
**/*.{php,js,ts,jsx,tsx}: Don't trust that extension developers will follow the best practices, make sure the code:
- Guards against unexpected inputs.
- Sanitizes and validates any potentially dangerous inputs.
- Is backwards compatible.
- Is readable and intuitive.
- Has unit or E2E tests where applicable.
When making any changes to code that deletes or modifies orders/products/customer data, make sure that there are
sufficient checks in place to prevent accidental data loss. As an example, if deleting a draft order, check that
the order status is indeeddraftorcheckout-draft. Also think about whether race conditions could occur and
delete orders that don't belong to the current customer. When in doubt, ask for clarification in the PR comments.
Files:
plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/types.tsplugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: jorgeatorres
Repo: woocommerce/woocommerce PR: 59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in `plugins/woocommerce/changelog/` directory and are processed during releases, not at the repository root level.
Learnt from: annemirasol
Repo: woocommerce/woocommerce PR: 60578
File: plugins/woocommerce/includes/gateways/paypal/includes/settings-paypal.php:104-113
Timestamp: 2025-09-03T17:16:04.109Z
Learning: For the PayPal WPS migration project in WooCommerce, legacy settings (marked with 'is_legacy' => true in settings-paypal.php) should not be modified as part of the migration work. Changes to legacy settings should be handled in separate PRs to maintain focused scope on the WPS migration functionality.
Learnt from: jamesckemp
Repo: woocommerce/woocommerce PR: 60816
File: plugins/woocommerce/includes/class-wc-post-types.php:485-492
Timestamp: 2025-09-12T13:24:41.207Z
Learning: In WooCommerce PR #60816, the shop_order post type registration correctly uses 'show_in_menu' => true to create a top-level Orders menu, moving away from the previous submenu structure under WooCommerce. This is intentional and aligns with the PR goal of promoting Orders to top-level navigation.
📚 Learning: 2025-07-15T15:39:21.856Z
Learnt from: jorgeatorres
Repo: woocommerce/woocommerce PR: 59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in `plugins/woocommerce/changelog/` directory and are processed during releases, not at the repository root level.
Applied to files:
plugins/woocommerce/changelog/61797-update-WCCOM-1896-hide-install-button-for-saas-products
📚 Learning: 2025-07-24T05:37:00.907Z
Learnt from: dinhtungdu
Repo: woocommerce/woocommerce PR: 59900
File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/attribute-filter/inspector.tsx:0-0
Timestamp: 2025-07-24T05:37:00.907Z
Learning: The DisplayStyleSwitcher component in plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/components/display-style-switcher/index.tsx has been updated so that its onChange prop accepts only a string type (not string | number | undefined), eliminating the need for type assertions when using this component.
Applied to files:
plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/types.tsplugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx
🔇 Additional comments (2)
plugins/woocommerce/changelog/61797-update-WCCOM-1896-hide-install-button-for-saas-products (1)
1-4: LGTM!The changelog entry follows the correct format and clearly describes the UI change.
plugins/woocommerce/client/admin/client/marketplace/components/my-subscriptions/types.ts (1)
36-36: Naming concern remains valid; manual verification of field usage required.The search reveals
has_changelogis newly added to theSubscriptiontype but no component usage was found in the marketplace directory yet. The type definition also shows several installable-related fields:
subscription_available(product can be installed)is_installable(line 33)has_changelog(line 36, new)SubscriptionLocal.installable(separate context)The semantic naming concern stands:
has_changelogsuggests changelog documentation rather than installable files/download packages. The relationship betweenis_installableandhas_changelogremains unclear.Please verify:
- How
has_changelogis actually used in component rendering logic (likely outside the marketplace directory)- Whether
is_installableandhas_changelogserve distinct purposes or should be consolidated- Consider renaming to
has_download,has_installation_package, or similar if the field gates the Install button
...ommerce/client/admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx
Show resolved
Hide resolved
Testing GuidelinesHi @gedex @bor0 @woocommerce/desire, 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:
|
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. |
Submission Review Guidelines:
Changes proposed in this Pull Request:
At the moment, the My Subscriptions page shows an Install button for SaaS products, which don't have an installation file hosted on either WooCommerce.com or WordPress.org. We need to hide the button for those products, so we're not offering an action that's not possible.
Part of WCCOM-1896
Related WooCommerce.com PR: https://github.com/Automattic/woocommerce.com/pull/24640
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
add/WCCOM-1896-has-changelog-propbranch is checked out on your WooCommerce.com dev environment, and that you have a user with an active SaaS/non-downloadable product (see test instructions for https://github.com/Automattic/woocommerce.com/pull/24640)docker network connect woocommerce.test <wc core container id>Testing that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Hide Install button for marketplace subscriptions that don't have anything to install
Changelog Entry Comment
Comment