Comments (5)
We ran into a similar issue not long ago, it turns out that this happens because of the useEffect that creates the checkout and mounts it is executed multiple times because your useEffect hook has dependencies. We removed our dependencies from the array and that fixed our issue.
from adyen-web.
We ran into a similar issue not long ago, it turns out that this happens because of the useEffect that creates the checkout and mounts it is executed multiple times because your useEffect hook has dependencies. We removed our dependencies from the array and that fixed our issue.
It doesn't sound like a solution at all: if I remove dropinContainer from dependencies dropin component won't mount correctly.
from adyen-web.
Hi @nastikue, and thanks for reaching out.
After seeing the code snippet you shared it seems the problem here is that you're using createRef
, which will return a new ref on every render. Using useRef
instead should solve the issue.
I made a quick demo here where you can see it in action.
https://codesandbox.io/s/frosty-hill-tmupv?file=/src/App.js
I'm using the Sepa component instead of the Card component just to simplify the demo, but it's the same thing.
Hope this helps, let us know if there's anything else!
from adyen-web.
@pabloai thank you for your research, it really helped much: saving to state works after createRef is changed to useRef. There is warning in adyen documentation to avoid DOM element rerenders https://docs.adyen.com/checkout/drop-in-web http://prntscr.com/vthj7b and I found out that similar error can be received if to define a callback inside sibling element, i.e. onClick in button in the below example:
<div className="App">
<div
ref={dropinContainer}
className="dropin-component"
data-test-id="dropin-container"
/>
<button onClick={()=> console.log('button')}>Button that produces error</button>
</div>
I think that these errors handling should be added in adyen to make it clear to developers where the problem is.
from adyen-web.
Hi @nastikue,
I'm glad that helped. About the warning in the Docs, it's to favor passing a reference to the mount
method instead of passing a DOM element or a selector string In your example this is done correctly.
Regarding the arrow functions in the JSX props, keep in mind this is a bad practice in React anyway. There's even a lint rule to check this: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
Cheers,
from adyen-web.
Related Issues (20)
- Serve 3DS iframes in a way, that the hosting website doesn't need to remove CSP for frame-src HOT 1
- Card custom integration ( secure fields) - TypeError: Invalid attempt to destructure non-iterable instance. HOT 1
- support paysafecard type definition in web component & typescript HOT 1
- Installment for saved credit card HOT 2
- Blik svg not available after upgrade to 5.55.0. (404) HOT 5
- IFrame.scss styles not being applied HOT 3
- IMPLEMENTATION_ERROR : Could not submit payment HOT 1
- Sometimes the status check QR code doesn't wait for the previous request to complete or times out. HOT 3
- Duplicate brand image HOT 2
- Swish onComplete or OnPaymentComplete never gets fired HOT 6
- Drop-in integration - Fields are disabled HOT 7
- Must declare the property "paymentTiming" in the ApplePayLineItem interface since is needed for recurring payments HOT 1
- SecuredFields take too long to configure on CircleCI HOT 1
- Type onAdditionalDetails argument in CoreOptions HOT 7
- [Web Drop-in] challengeWindowSize type in CoreOptions.paymentMethodsConfiguration HOT 2
- [Web Drop-in] Allow hiding amount HOT 4
- `showPayButton` not working for stored ACH HOT 2
- Slash not allowed in Street and House number fields in Drop-in HOT 5
- `undefined is not an object (evaluating 'this.touchendListener')` error on Safari HOT 2
- [Web - DropIn] On iOS Safari, scanning a card is entering the wrong expiryDateField
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adyen-web.