p5.js-web-editor
p5.js-web-editor copied to clipboard
fix(client): show toast notifications on file/folder rename validatio…
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
validateFileNameinFileNode.jsxto check and dispatchshowToastnotifications on validation failures. - Updated
FileNode.unit.test.jsxto mockshowToastand 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
developbranch.
🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.
@Dakshx07 could you add a screen recording please?