datatrans / secure-fields-sample

Visually pleasing credit card forms with Datatrans Payment Gateway and PCI Proxy.
https://datatrans.github.io/secure-fields-sample/
MIT License
7 stars 7 forks source link

Missing dependencies in useEffect in react-example-initTokenize #27

Closed Mhmdabed11 closed 1 year ago

Mhmdabed11 commented 1 year ago

Problem Description

I am trying to use the react-example-initTokenize sample provided. I noticed that there are missing dependencies in the array in useEffect in the code.

Example 1

In the code below, the useEffect is missing 4 dependencies which are: Here is a link to the code: https://github.com/datatrans/secure-fields-sample/blob/master/react-example-initTokenize/src/SecureFields.js#L51 cleanupSecureFields, initSecureFields, production, secureFields .

image

Example 2

In the code below, the useEffect is missing some dependancies: cardContainerClassNames, cvvContainerClassNames, secureFields Here is a link to the code: https://github.com/datatrans/secure-fields-sample/blob/master/react-example-initTokenize/src/SecureFields.js#L73 image

Proposed Solution:

I believe that the dependencies should be added to avoid rendering bugs.

pstadler commented 1 year ago

So, does it work for you, or are you seeing any bugs?

Please let us know if something does indeed lead to rendering being buggy.