Sitelet https://github.com/processing/p5.js-web-editor/pull/4311
Skip to content

Fix saveProject TypeError on network errors - #4311

Open
dyk1454683243-sudo wants to merge 3 commits into
processing:developfrom
dyk1454683243-sudo:cursor/fix-saveproject-network-error-4276-44eb
Open

dyk1454683243-sudo wants to merge 3 commits into
processing:developfrom
dyk1454683243-sudo:cursor/fix-saveproject-network-error-4276-44eb

Conversation

@dyk1454683243-sudo

Copy link
Copy Markdown

Issue:

Fixes #4276

When saveProject fails with a network error, Axios rejects without error.response. Both the update (PUT) and create (POST) .catch handlers then threw TypeError on response.status / response.data instead of running the normal save-failure path.

This is a fresh PR from current develop. Prior closed unmerged attempt: #4304.

Demo:

No UI change. Network save failures now keep the existing failure toast / projectSaveFail behavior instead of an unhandled rejection.

Changes:

  • Guard response?.status and response?.data in both saveProject catch blocks (client/modules/IDE/actions/project.js).
  • Add unit tests for error.response === undefined on update and create, and keep 403 / 409 modal behavior covered (client/modules/IDE/actions/project.unit.test.js).

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 #4276
  • meets the standards outlined in the accessibility guidelines

Guard both saveProject catch handlers so a missing error.response no
longer throws when reading status or data. Network failures now run the
normal save-failure path (end saving, toast, projectSaveFail).

Fixes processing#4276

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@welcome

welcome Bot commented Sep 20, 2026

Copy link
Copy Markdown

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

@clairep94 clairep94 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! @dyk1454683243-sudo could you rebase and tag me? ready to merge after

@clairep94 clairep94 self-assigned this Oct 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused fix correctly covers both save paths with appropriate regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes network-error handling during project saves so failures follow the normal toast and failure-action path.

Changes:

  • Safely handles missing Axios responses for PUT and POST saves.
  • Adds coverage for network, 403, and 409 failures.
File Description
client/​modules/​IDE/​actions/​project.js Guards access to optional error responses.
client/​modules/​IDE/​actions/​project.unit.test.js Tests save-failure behavior and existing modal handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch was successfully deployed

1 active deployment
e2e-tests — 7f54bd6a Deployed Oct 3, 2026 by dyk1454683243-sudo via test-e2e #334
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.

saveProject throws an error when a network request fails

4 participants