-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
The onAfterEmailVerified hook is being triggered twice in development mode when using Wasp's <VerifyEmailForm /> component, causing duplicate operations (e.g., welcome emails being sent twice).
Technically this isn't a bug but expected behaviour: React 18's Strict Mode renders components twice in development to check if components are doing their cleanup correctly. Since <VerifyEmailForm /> triggers the verification backend endpoint as soon as it's mounted, this results in the request being sent twice in development.
But it's unexpected for users and they might think it will happen in production.
Proposed solution
Implement a similar workaround as was done for the OAuth component to prevent the backend from being triggered twice in development mode.
Based on https://discord.com/channels/686873244791210014/1438285961225044039/1441432541402763446