Skip to content

Conversation

@marsidev
Copy link
Owner

@marsidev marsidev commented Aug 5, 2025

In the (v1.1.0), as reported in #103, the callbacks were not part of the renderConfig's useMemo dependency array. Which means that if one of those callbacks gets updated, the widget won't re-render so the next callbacks invokations may use stale state.

In #105 (v.1.2.0), the callbacks were added into the useMemo dependency array, so now if one of those callbacks gets updated, the widget re-renders. As that is intended, it silently introduces a bug where the widget may invoke the callbacks more than once, causing an "endless loading" or similar unexpected bahavior. This was reported in #107

This PR introduces a rerenderOnCallbackChange prop to solve both issues (available in v.1.3.0).

By default is set to false, so the behavior is exactly as it was in v1.1.0. If the user needs to re-render on callback updates, the rerenderOnCallbackChange prop should be set to true, and also wrap the callbacks with useCallback.

@marsidev marsidev linked an issue Aug 5, 2025 that may be closed by this pull request
3 tasks
@codesandbox
Copy link

codesandbox bot commented Aug 5, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@docs-page
Copy link

docs-page bot commented Aug 5, 2025

To view this pull requests documentation preview, visit the following URL:

docs.page/marsidev/react-turnstile~108

Documentation is deployed and generated using docs.page.

@vercel
Copy link

vercel bot commented Aug 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-turnstile ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2025 5:44pm

@marsidev marsidev merged commit 487a7dd into main Aug 5, 2025
6 checks passed
@marsidev marsidev deleted the 107-bug-in-new-version-it-keeps-verifying-never-gone-resolve branch December 28, 2025 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: In new version, it keeps verifying, never gone resolve

2 participants