Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
80 stars 29 forks source link

Block the ui after the user clicks a subscriotion status update action #565

Closed james-allan closed 4 months ago

james-allan commented 4 months ago

Fixes https://github.com/woocommerce/woocommerce-subscriptions/issues/4613

Description

This PR blocks the view subscriptions UI when the customer clicks one of the status changing URLs.

https://github.com/Automattic/woocommerce-subscriptions-core/assets/8490476/1c1d10be-bf74-4215-a136-be8cde736616

How to test this PR

  1. Checkout out this branch.
  2. Go to the My Account > View subscription page.
  3. Click the cancel, activate, suspend buttons and confirm you can no longer spam the button.
  4. Click the other actions (change address, change payment etc) you'll notice the UI isn't blocked.
  5. If you have the early renewal modal enabled. It won't block the ui. If you don't have the modal enabled, it will block the ui.

Product impact

james-allan commented 4 months ago

Click the ... suspend buttons If you have the early renewal modal enabled. It won't block the ui. If you don't have the modal enabled, it will block the ui.

I just realised this come from the subscriptions plugin itself, not subscriptions core so they will need to handled separately.

mattallan commented 4 months ago

I just realised this come from the subscriptions plugin itself, not subscriptions core so they will need to handled separately.

I like your approach with default behaviour being to not block the UI, so it's not critical we update the main subscriptions plugin. Is it?

james-allan commented 4 months ago

I like your approach with default behaviour being to not block the UI

Yeah at first I applied it to all buttons but that broke the early renewal modal as it isn't a redirect, and the blocked UI was also impacting the modal (see below). I also figured I shouldn't subscribe any custom buttons to this UI blocking as it could break their functionality too.

Screenshot 2024-02-08 at 1 11 36 pm

so it's not critical we update the main subscriptions plugin. Is it?

Yeah I guess so only the cancel button really needs this blocking because activating and suspending shouldn't really be impacted given they have a 1:1 status update and resubscribing is a redirect to the checkout.