Possible Wallet Mounting Error #99
-
Hello guys, I am a new developer - so sorry if this mistake might look dumb. I am using Next JS and I am mounting the Wallet Component, at my checkout page, but it seems it is being mounted twice, and sometimes more than twice. And I think this error occurs because the wallet is not able to unmount some DOM element. I also have a GET 405 error when mounting it. I was creating the preference before going to the checkout page, but due to my logic - I changed to creating the preference when clicking the button - so now I also get this get_preference_details_failed. ( But i guess it is not critical right? kkkk ) Other than that the wallet works fine, I am able to process the payment and make tests - But i am getting this error and it is really annoying and breaking my website experience. I cannot find resources to help me at mercado pago dev docs. Those are the errors i get: ( i replaced my public key to not show it here )
And this is how part of my code related to the wallet looks:
What should i do? I would appreciate the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Good afternoon @Tarranzilla , how are you? First of all, no question is dumb, and it is always welcome! It's good to know that the component works well, regarding multiple renderings and the difficulty of handling using next js, I'll refer you to this wiki link, here are some tips on how to use this SDK in next js. I also believe that it could be a failure in the application life cycle and is triggering some renderings at inappropriate times. I will indicate a few good reading links that can help you in dealing with this type of problem. React.dev - Memo If none of these articles help you, I hope you add more snippets from your complete implementation. |
Beta Was this translation helpful? Give feedback.
Good afternoon @Tarranzilla , how are you?
First of all, no question is dumb, and it is always welcome!
It's good to know that the component works well, regarding multiple renderings and the difficulty of handling using next js, I'll refer you to this wiki link, here are some tips on how to use this SDK in next js.
I also believe that it could be a failure in the application life cycle and is triggering some renderings at inappropriate times. I will indicate a few good reading links that can help you in dealing with this type of problem.
React.dev - Memo
Medium - React Components rendered twice
Medium - Wait, you’re not using <React.StrictMode>?!
If none of these articles help you, I hope…