Skip to content

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

Description

@slash-init

p5.js version

2.3.2

What is your operating system?

Linux

Web browser and version

firefox 153.0.1

Actual Behavior

If the signup request fails because of a network error, the signup form gets stuck in the submitting state indefinitely.
the error handler in validateAndSignUpUser() assumes that error.response always exists and tries to access response.data.error. for network errors, axios doesn't provide a response object, so this throws a TypeError before the promise can resolve.
i get:
TypeError: Cannot read properties of undefined (reading 'data')
the form stays stuck in the submitting state instead of showing an error or finishing the submission.

Expected Behavior

If the signup request fails because of a network error, the error should be handled gracefully and the signup form should stop submitting and show an appropriate error message.

Steps to reproduce

  1. open the p5.js web editor and go to the signup page
  2. enter valid signup details
  3. make the POST /signup request fail with a network error, for example by disconnecting the network or blocking the request
  4. submit the form
  5. notice that the form stays in the submitting state and no useful error is shown

Snippet:

.catch((error) => {
  const { response } = error;
  dispatch(authError(response.data.error));
  resolve({ error });
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting Maintainer ApprovalNeeds review from a maintainer before moving forwardBugError or unexpected behaviors

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions