p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

fix(client): show toast notifications on file/folder rename validatio…

Open Dakshx07 opened this issue 5 months ago • 1 comments

Issue:

Fixes #4176

Description:

This PR resolves a usability issue where file and folder rename inputs fail validation silently and revert back to their original names. We now display appropriate toast messages explaining why the rename failed:

  • Reverts empty file name -> shows "Please enter a name".
  • Reverts empty folder name -> shows "Please enter a name".
  • Reverts folder name containing dots/extension -> shows "Folder name cannot contain an extension".
  • Reverts file name with missing or unsupported extension -> shows "Invalid file type...".

Changes:

  • Refactored validateFileName in FileNode.jsx to check and dispatch showToast notifications on validation failures.
  • Updated FileNode.unit.test.jsx to mock showToast and assert that it is called on all validation failures.

I have verified that this pull request:

  • [x] has no linting errors (npm run lint)
  • [x] has no test errors (npm run test)
  • [x] is from a uniquely-named feature branch and is up to date with the develop branch.

Dakshx07 avatar Jun 14 '26 12:06 Dakshx07

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

welcome[bot] avatar Jun 14 '26 12:06 welcome[bot]

@Dakshx07 could you add a screen recording please?

clairep94 avatar Sep 01 '26 16:09 clairep94