Skip to content

♦fix: handle network errors in validateAndSignUpUser (#4285) - #4294

Open
PS01K wants to merge 1 commit into
processing:developfrom
PS01K:fix/signup-network-error
Open

♦fix: handle network errors in validateAndSignUpUser (#4285)#4294
PS01K wants to merge 1 commit into
processing:developfrom
PS01K:fix/signup-network-error

Conversation

@PS01K

@PS01K PS01K commented Sep 4, 2026

Copy link
Copy Markdown

Issue:

Fixes #4285

When submitting the signup form during a network error, request timeout, or server disconnection, Axios produces an error object where error.response is undefined.

Previously, validateAndSignUpUser() attempted to access response.data.error directly inside its .catch() handler. This caused a synchronous TypeError: Cannot read properties of undefined (reading 'data'), preventing resolve({ error }) from executing. Consequently, the promise returned to React Final Form remained pending indefinitely, freezing the signup form in a permanent submitting state with disabled submit controls and no user feedback.

Changes:

  • client/modules/User/actions.ts:
    • Safely extract error messages in validateAndSignUpUser using optional chaining (error.response?.data?.error || error.response?.data?.message || error.message || 'Unknown error.') so authError is dispatched and resolve({ error }) is always reached.
    • Updated authError(error: Error | string) type definition to permit string error payloads.
    • Guarded against similar missing error.response crashes in validateAndLoginUser, logoutUser, unlinkService, and setUserCookieConsent.
    • Returned the promise from logoutUser thunk.
  • client/modules/User/actions.unit.test.ts:
    • Added unit test suite covering successful signup, API 422 error handling, network error fallbacks (ensuring the promise resolves and does not hang), and login/logout error handling.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #4285
  • meets the standards outlined in the accessibility guidelines

- Guard against undefined error.response in validateAndSignUpUser by safely extracting message via optional chaining

- Update authError type definition to accept string payloads

- Guard against similar missing error.response crashes in validateAndLoginUser, logoutUser, unlinkService, and setUserCookieConsent

- Return promise from logoutUser thunk

- Add unit tests covering signup, login, and logout network error handling
@welcome

welcome Bot commented Sep 4, 2026

Copy link
Copy Markdown

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.

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.

signup form gets stuck when signup request fails due to network error

1 participant