You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Renaming a folder doubles the folder name in file paths (console errors show /lib/lib/helper.js) #4365
After renaming a folder in the sidebar, the editor stores a wrong path for the
folder and every file inside it: the folder's own name is added twice. This shows
up in console errors. A script in a renamed folder lib reports its error at /lib/lib/helper.js:1:1 instead of /lib/helper.js:1:1
When logged in, the wrong path only lasts until the next save (each save rebuilds
the paths). When logged out, nothing is saved to the server, so it stays wrong for
the whole session.
Cause: in client/modules/IDE/reducers/files.js, the UPDATE_FILE_NAME case loops
over the folder's children but passes action.id (the folder itself) instead of childId to setFilePath:
After renaming folder js to lib, files inside it should have the path /lib/..., and the console should show at /lib/helper.js:1:1.
Steps to reproduce
Open editor.p5js.org while logged out.
Create a folder js, and inside it a file helper.js containing noSuchFunction();
In index.html, add <script src="js/helper.js"></script> above the sketch.js script tag.
Press Play and expand the error in the console: at /js/helper.js:1:1 (correct).
Rename the folder js to lib and change the script tag to lib/helper.js.
Press Play and expand the error: at /lib/lib/helper.js:1:1 (wrong).
Suggested fix: pass childId instead of action.id to setFilePath in the UPDATE_FILE_NAME case. I've tested this locally with unit tests for the reducer
(top-level and nested folder renames); the existing tests in files.test.js only
cover deletion. I'd be happy to open a PR with the fix and tests if this is approved.
Related: #2186 (mutation in the files reducer), a different issue in the same file.
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.
Activity
welcome commentedon Oct 16, 2026
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.