captcha throws error on pageload

UI Components for React
Post Reply
kaho29
Posts: 18
Joined: 18 Aug 2017, 10:57

13 Jun 2018, 09:50

I stumbled upon a problem with the captcha component. When loading a page containing the captcha it sometimes throws the following error:

Code: Select all

Uncaught TypeError: window.grecaptcha.render is not a function
    at t.value (Captcha.js:44)
    at t.value (Captcha.js:108)
    at commitLifeCycles (react-dom.production.min.js:149)
    at t (react-dom.production.min.js:158)
    at E (react-dom.production.min.js:169)
    at w (react-dom.production.min.js:168)
    at f (react-dom.production.min.js:167)
    at h (react-dom.production.min.js:165)
    at Object.updateContainer (react-dom.production.min.js:175)
    at react-dom.production.min.js:225
It seems to be a timing problem because when I load the page without cache (what takes a minimal ammount of time longer) the captcha works as expected.

kaho29
Posts: 18
Joined: 18 Aug 2017, 10:57

18 Jun 2018, 11:51

As I thought this is a timing problem. I put an async parameter in the <script> loading recaptcha inside the index.html.

If you remove the async it works. Probably you should add a check inside the recaptcha component to prevent a blank page when recaptcha is not present while mounting the component...

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests