Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show loader on INITIALIZE step #260

Open
DmitriyMuliak opened this issue Nov 30, 2023 · 2 comments
Open

Show loader on INITIALIZE step #260

DmitriyMuliak opened this issue Nov 30, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@DmitriyMuliak
Copy link

DmitriyMuliak commented Nov 30, 2023

Hi 馃憢

Description:

Library have onPaymentDataChanged callback. It triggering with paymentData arguments.
This callback can return promise.
We handle initialization step -> paymentData.callbackTrigger === 'INITIALIZE' and do some async stuff.
But in this case loader is not shown.
For example for cases callbackTrigger === 'SHIPPING_OPTION' || callbackTrigger === 'SHIPPING_ADDRESS' it shows.

Video:

GooglePayInitialize.mp4

To Reproduce:

Add async stuff to onPaymentDataChanged when paymentData.callbackTrigger === 'INITIALIZE'.
and return promise with new paymentData.
You will see blink price without any loader.
For example:
if(paymentData.callbackTrigger === 'INITIALIZE')
await new Promise(r => setTimeout(r, 2000)); // do some api calls
return newPaymentDataWithUpdatedTotalPrice

Fiddle:
https://jsfiddle.net/un0rjm7d/3/

Expected behavior:
In case when paymentData.callbackTrigger === 'INITIALIZE' and onPaymentDataChanged return promise with new paymentData -> show loader until promise will be resolved.

Component information:

  • Component
    • React component (@google-pay/button-react)
  • Component version (3.0.10):

Environment:

  • Device: any
  • OS: any
  • Browser: any
  • Country/region: any

Additional context:

On initialization step (after click on Gpay button) we call our api for check internal stuff and can return new totalPrice.
For example we can check address and calculate new price.
But user see old data without loader and trying to click pay -> nothing happens -> price updating -> user confused.
In case when user have slow internet connection he didn't know why he can't pay and decide to leave.
But at the same time when callbackTrigger === 'SHIPPING_OPTION' || callbackTrigger === 'SHIPPING_ADDRESS'
we also do some async stuff but in this case user will see loader until our promise will be resolved.

@DmitriyMuliak DmitriyMuliak added the bug Something isn't working label Nov 30, 2023
@dmengelt
Copy link
Member

dmengelt commented Dec 1, 2023

@DmitriyMuliak thanks for reporting this! this is a bug. we will look into it. Unfortunately I can't give you an estimation on when we will fix this yet.

@jocmp
Copy link

jocmp commented Jan 19, 2024

Hey @dmengelt, I'm also running into the same issue. Do you have any recommendations for workarounds instead of a fix?

@dmengelt dmengelt self-assigned this Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants