woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.43k stars 10.77k forks source link

[9.2.2] useConfirmUnsavedChanges persists in WooPayments and Stripe for WooCommerce settings when all changes are saved #50936

Open csmcneill opened 3 months ago

csmcneill commented 3 months ago

Prerequisites

Describe the bug

With WooCommerce 9.1.4 active, saving settings in WooPayments and/or Stripe for WooCommerce allows navigating to another page without issue.

After updating to 9.2.2, saving settings in WooPayments or Stripe for WooCommerce and then navigating away produces a Leave site? JS popup (useConfirmUnsavedChanges):

Leave site?

Changes you made may not be saved.

This popup is usually only present when there are unsaved changes.

This may affect other extensions, but (so far) I've only been able to reproduce this in WooPayments and Stripe for WooCommerce.

Expected behavior

  1. After making changes to WooPayments or Stripe for WooCommerce settings, the useConfirmUnsavedChanges popup should only render if there are unsaved changes.
  2. After saving changes in the WooPayments or Stripe for WooCommerce settings, navigating away from those settings pages should not require confirmation.

Actual behavior

After saving settings in WooPayments and Stripe for WooCommerce, navigating away from the page produces a useConfirmUnsavedChanges popup, which can indicate that there are unsaved changes — even if there aren't any.

Steps to reproduce

  1. Install WooCommerce 9.1.4.
  2. Install WooPayments.
  3. Activate WooPayments.
  4. Go through the sandbox mode process to create a test account.
  5. Navigate to the payment settings at Payments > Settings.
  6. Change a setting.
  7. Save the changes.
  8. Navigate to another page.
  9. Note that there is no useConfirmUnsavedChanges popup.
  10. Update to WooCommerce 9.2.2.
  11. Repeat steps 5–8.
  12. Note that there is a useConfirmUnsavedChanges popup.

WordPress Environment

System Status Report ``` ### WordPress Environment ### WordPress address (URL): [Redacted] Site address (URL): [Redacted] WC Version: 9.2.2 Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site. Action Scheduler Version: ✔ 3.8.1 Log Directory Writable: ✔ WP Version: 6.6.1 WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: ✔ ### Server Environment ### Server Info: nginx PHP Version: 8.1.29 PHP Post Max Size: 2 GB PHP Time Limit: 1200 PHP Max Input Vars: 6144 cURL Version: 8.7.1 OpenSSL/3.0.11 SUHOSIN Installed: – MySQL Version: 10.6.18-MariaDB-log Max Upload Size: 2 GB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### [REDACTED] ### Post Type Counts ### attachment: 4 jetpack_migration: 2 jp_img_sitemap: 7 jp_sitemap: 7 jp_sitemap_master: 7 mailpoet_page: 1 page: 7 post: 7 product: 1 shop_order_placehold: 1 wp_global_styles: 1 wp_navigation: 1 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (3) ### Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3.3 WooCommerce Stripe Gateway: by WooCommerce – 8.6.1 WooCommerce: by Automattic – 9.2.2 ### Inactive Plugins (38) ### AutomateWoo: by WooCommerce – 6.0.32 Avalara AvaTax: by Avalara – 2.8.0 Blaze Ads: by Automattic – 0.4.1 Classic Editor: by WordPress Contributors – 1.6.4 Crowdsignal Forms: by Automattic – 1.7.2 Crowdsignal Polls & Ratings: by Automattic Inc. – 3.1.2 Facebook for WooCommerce: by Facebook – 3.2.7 Google Analytics for WooCommerce: by WooCommerce – 2.1.6 Google for WooCommerce: by WooCommerce – 2.8.3 Gutenberg: by Gutenberg Team – 19.0.0 Jetpack: by Automattic – 13.8-a.5 Layout Grid: by Automattic – 1.8.4 MailPoet: by MailPoet – 5.0.1 MailPoet Premium: by MailPoet – 5.0.0 Page Optimize: by Automattic – 0.5.5 Pinterest for WooCommerce: by WooCommerce – 1.4.6 TaxJar - Sales Tax Automation for WooCommerce: by TaxJar – 4.2.3 TikTok: by TikTok – 1.2.8 Woo AI: by WooCommerce – 0.6.0 Woo Back In Stock Notifications: by Woo – 2.0.1 WooCommerce.com Update Manager: by Automattic – 1.0.3 WooCommerce Australia Post Shipping: by WooCommerce – 2.6.2 WooCommerce Brands: by WooCommerce – 1.7.5 WooCommerce Canada Post Shipping: by WooCommerce – 3.0.1 WooCommerce EU VAT Number: by WooCommerce – 2.9.6 WooCommerce FedEx Shipping: by WooCommerce – 4.0.2 WooCommerce Royal Mail: by WooCommerce – 3.3.3 WooCommerce Shipment Tracking: by WooCommerce – 2.5.0 WooCommerce Shipping & Tax: by WooCommerce – 2.7.0 WooCommerce UPS Shipping: by WooCommerce – 3.7.0 WooCommerce USPS Shipping: by WooCommerce – 5.0.0 Woo Gift Cards: by Woo – 2.0.1 Woo Min/Max Quantities: by Woo – 5.0.1 WooPayments: by WooCommerce – 8.0.2 Woo Product Add-ons: by Woo – 7.0.1 Woo Product Bundles: by Woo – 8.0.1 Woo Product Recommendations: by Woo – 4.0.2 WordPress.com Editing Toolkit: by Automattic – 4.30504 ### Dropin Plugins () ### advanced-cache.php: advanced-cache.php object-cache.php: Memcached ### Must Use Plugins (1) ### wpcomsh-loader.php: by – ### Settings ### Legacy API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: bundle (bundle) external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: ✔ Enforce Approved Product Download Directories: ✔ HPOS feature enabled: ✔ Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore HPOS data sync enabled: – ### Logging ### Enabled: ✔ Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2 Retention period: 30 days Level threshold: – Log directory size: 79 KB ### WC Pages ### Shop base: #20 - /shop/ Cart: #21 - /cart/ - Contains the woocommerce/cart block Checkout: #22 - /checkout/ - Contains the woocommerce/checkout block My account: #23 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Twenty Twenty-Four Version: 1.2 Author URL: https://wordpress.org Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ❌ Not declared ### Templates ### Overrides: /wordpress/plugins/woocommerce/9.2.2/templates/block-notices/error.php /wordpress/plugins/woocommerce/9.2.2/templates/block-notices/notice.php /wordpress/plugins/woocommerce/9.2.2/templates/block-notices/success.php ### Admin ### Enabled Features: activity-panels analytics product-block-editor coupons core-profiler customize-store customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner onboarding onboarding-tasks pattern-toolkit-full-composability product-custom-fields remote-inbox-notifications remote-free-extensions payment-gateway-suggestions printful shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page Disabled Features: experimental-blocks minified-js navigation product-pre-publish-modal settings async-product-editor-category-field launch-your-store product-editor-template-system Daily Cron: ✔ Next scheduled: 2024-08-24 19:30:37 -05:00 Options: ✔ Notes: 59 Onboarding: completed ### Action Scheduler ### Complete: 132 Oldest: 2024-08-01 16:33:19 -0500 Newest: 2024-08-23 16:23:45 -0500 Failed: 33 Oldest: 2024-08-19 17:21:13 -0500 Newest: 2024-08-23 17:19:51 -0500 Pending: 4 Oldest: 2024-08-23 17:20:51 -0500 Newest: 2024-08-24 16:19:00 -0500 ### Status report information ### Generated at: 2024-08-23 17:20:02 -05:00 ```

Isolating the problem

csmcneill commented 3 months ago

Discussion: p1724435782644049-slack-CGGCLBN58 Video:

https://github.com/user-attachments/assets/f85bd021-ded7-41f3-af01-1496d60fddd5

I tried looking for a PR that is related to this change in the 9.2 milestone, but I'm coming up short.

vbelolapotkov commented 3 months ago

@pierorocca @c-shultz routing this one to you for prioritization, because demo shows LPMs management triggers that. But also pinging @anu-rock @timmy5685 for awareness in case it's general settings management issue.

pierorocca commented 3 months ago

@FangedParakeet related to the save button issue I opened.