metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

Fair Launch frontend does not update Candy Machine V2 state after minting one token #1344

Closed akserikawa closed 2 years ago

akserikawa commented 2 years ago

Describe the bug After succesfully minting one token, the candy machine instance does not get refreshed to display the correct number of items available, redeemed and remaining. This results in a bad UX, because the user just minted the token, but the UI does not reflect this change. It is necessary to reload the page completely to see this change.

To Reproduce Steps to reproduce the behavior:

  1. Setup a Candy Machine V2 with a few items in it.
  2. Mint through the FLP frontend.
  3. After mint ends, check the state property on candy machine instance (in the console)
  4. Check the state remains the same. It does not refresh.

Expected behavior After minting one token, the state of the candyMachine instance should get refreshed correctly, with itemsRedeemed+1, and itemsRemaining-1

Desktop (please complete the following information):

Additional context The logic that actually queries the candy machine state is in candy-machine.ts -> getCandyMachineState() function. This function gets called via React useEffect hook, but it does not return the newer state.

akserikawa commented 2 years ago

Might be due to Tx confirmations not reaching a minimum value?

Tried both on devnet and mainnet setting up timeouts of +15 secs and it eventually refreshes the status. But why does it take so long? On exiled apes frontend it took 5 seconds at most to refresh state.

kyleqian commented 2 years ago

Same issue here

Blueberry94 commented 2 years ago

Here too