Failure to load script is not handled
IanVS opened this issue · 0 comments
Do you want to request a feature or report a bug?
Somewhere in between a bug and feature
What is the current behavior?
If https://challenges.cloudflare.com/turnstile/v0/api.js
cannot be loaded, such as during the Cloudflare outage yesterday, there seems to be no way to catch the failure and show a fallback UI or handle the failure. In my case, I'd like to "fail open" and proceed even if turnstile cannot load. However, when the script fails to load, the onError
callback of the component is not triggered.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox example below:
This can be reproduced by blocking the request to https://challenges.cloudflare.com/turnstile/v0/api.js
in the network tab, and observe what happens.
What is the expected behavior?
I expected onError
to be triggered.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
I don't think this has anything to do with React/browser/OS, it's due to the way that the script is injected, and then the rest of the code expects turnstile
to be on window
, without any way to handle an error.