fix: handle waitlist restricted error & don't clear errors always on … #6818
+51
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…exit to prevent early clear
Description
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Error Iteration Fix
Errors were previously not being parse correctly on the
ERRORS.SET
event causing an issue of "errors not iterable". Thesign_up_restricted_waitlist
error does contain aclerkError
key, so it's considered a clerk api response error, but it does not have the plural "errors" in it, but a singular "error".Error Clearing Fix
Currently, when using the clerk elements
<GlobalError />
component, it does not correctly handle the state in when a user attempts to sign up when the waitlist only / invite only mode is enabled on clerk. The error gets briefly set in the form state, but the exit condition on the form machine clears the errors before they are rendered to the user.This fix will explicitly switch on this waitlist error code and it will not do a blanket clear of the errors on exit of the start state. This prevents the form from clearing errors prematurely.