Skip to content

[MOL-20692][AT] introduce recaptcha ready props to indicate the readiness of the component if the recaptcha has been set#596

Merged
weili-govtech merged 1 commit into
mainfrom
MOL-20692
May 11, 2026
Merged

[MOL-20692][AT] introduce recaptcha ready props to indicate the readiness of the component if the recaptcha has been set#596
weili-govtech merged 1 commit into
mainfrom
MOL-20692

Conversation

@thyAshley
Copy link
Copy Markdown
Contributor

introduces a reCAPTCHA readiness signal so consumers can safely determine when reCAPTCHA is available before making protected API requests.

Changes

  • Added a new isRecaptchaReady boolean to the reCAPTCHA context contract
  • Computed readiness as:
    • true when no reCAPTCHA site key is configured (support existing user without any impact)
    • true when reCAPTCHA is configured and fully loaded
    • false otherwise
  • Updated location search flow to guard API-dependent effects/actions until isRecaptchaReady is true.
  • delete branch

Changelog entry

  • Added isRecaptchaReady prop to reCAPTCHA context, allowing components to check reCAPTCHA availability before making protected API calls.

Additional information

  • Some location-related requests can execute before reCAPTCHA is actually usable causing an error modal to show for the user before they even use the component.
  • This causes avoidable failures or race-condition behavior when token generation is attempted too early.
  • The new readiness flag makes this explicit and prevents premature API calls.

@thyAshley thyAshley requested a review from weili-govtech May 11, 2026 02:08
@thyAshley thyAshley self-assigned this May 11, 2026
@weili-govtech
Copy link
Copy Markdown
Contributor

  • what about errors like invalid recaptcha key? can we show the "Map not available" error modal
  • add tests to guard this behaviour

@thyAshley
Copy link
Copy Markdown
Contributor Author

there is no validation of recaptcha key, if the key is wrong, we will still show map error modal as the api call will still fail.

@weili-govtech weili-govtech merged commit 3185d41 into main May 11, 2026
1 check passed
@weili-govtech weili-govtech deleted the MOL-20692 branch May 11, 2026 09:22
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.

2 participants