Closed iamdharmesh closed 2 months ago
Note: The failing test (1 test is failing) is already fixed in the PR https://github.com/woocommerce/woocommerce-square/pull/204
I have verified this PR in the enhancement/341
branch which has been fixed and is functioning as intended.
I tested the following on this branch:
Testing Environment
https://github.com/user-attachments/assets/df3f1b9c-ef2a-47f9-89c2-72c09a1ae9a3
https://github.com/user-attachments/assets/6f625dac-997b-4c14-a2dc-72dc120d7876
Going to close this out since the issue was resolved in Woo 9.3 itself and this fix is no longer needed
All Submissions:
Changes proposed in this Pull Request:
This PR fixes the CashApp Pay and Digital Wallet payments on Block Checkout for WooCommerce 9.3. The issue was occurring only with WooCommerce 9.3, and I suspect it's due to the React 18 upgrade in WC 9.3. The token updates in the state are not reflected in
onPaymentSetup
whenonSubmit
is called.This PR fixes the issue by replacing
onSubmit();
withsetTimeout( onSubmit, 0 );
, breaking out of the current event loop to ensure state updates inonPaymentSetup
. We are having an ongoing discussion with the Woo Team to figure out the proper fix. However, with WC 9.3 releasing tomorrow, proceeding with this fix for now is fine.Closes #214
Steps to test the changes in this Pull Request:
Changelog entry