hCaptcha / react-hcaptcha

hCaptcha Component Library for ReactJS and Preact
MIT License
371 stars 42 forks source link

`.execute` sometimes returns `undefined` instead of a `Promise` #237

Closed steved-stripe closed 3 months ago

steved-stripe commented 3 months ago

if this.isReady() is false, then this code path will return undefined:

https://github.com/hCaptcha/react-hcaptcha/blob/491bb96fe8c302b4c9f95c53547b92411c3532a5/src/index.js#L335-L337

which isn't compatible with the typescript type:

https://github.com/hCaptcha/react-hcaptcha/blob/491bb96fe8c302b4c9f95c53547b92411c3532a5/types/index.d.ts#L53

brdlyptrs commented 3 months ago

Hi @steved-stripe, thanks for flagging.

We'll take a further look into how we can align the internal functionality with what is expected. From what you mention, if async is set we want to make sure the code waits until ready to execute instead of immediately bailing if ready is false.

gabrielferreira-imi commented 3 months ago

Hi @steved-stripe,

We just released a fix in our latest 1.11.0 version. Could you please confirm it's working on your end?

Best regards, hCaptcha dev team