Renaming a folder doubles the folder name in file paths (console errors show /lib/lib/helper.js)
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, redux
- Ambito
- frontend
Direzione di ricerca
Il bug si trova nel caso UPDATE_FILE_NAME di client/modules/IDE/reducers/files.js, dove il ciclo sui figli passa action.id a setFilePath invece di childId. Leggi quel caso e l'helper setFilePath, poi aggiungi test del reducer per la rinomina di cartelle di primo livello e annidate in files.test.js, che attualmente coprono solo l'eliminazione. È completato quando rinominando la cartella js in lib i percorsi dei figli diventano come /lib/helper.js e i nuovi test passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
p5.js version
2.3.4
What is your operating system?
Mac OS
Web browser and version
155.0.8059.40 (Official Build) (arm64)
Actual Behavior
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:
updatedFile.children.forEach((childId) => {
setFilePath(newState, action.id, childPath);
});
Expected Behavior
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 filehelper.jscontainingnoSuchFunction(); - 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
jstoliband change the script tag tolib/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.
- Lingua principale
- JavaScript
- Stelle
- 1.7k
- Fork
- 1.7k
- Merge medio
- 5g 16h
- PR unite (30g)
- 8
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di processing/p5.js-web-editor
-
p5 logo is broken on verification emailsForse già presa @sourabh65mehta l’ha presa 6 giorni fa. ApertaBug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
processing/p5.js-web-editor#4364 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 3 giorni
-
`PATCH /editor/project/visibility` returns 200 with `null` and doesn't update when `projectId` is a slugForse di nuovo libera @Prbhtsgh l’ha presa 13 giorni fa e non c’è nessuna pull request aperta. ApertaAwaiting Maintainer Approval Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
processing/p5.js-web-editor#4348 · 3 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
Fix: example.js stores defaultHTML function reference instead of calling it, causing examples to display raw JavaScript source in previewForse di nuovo libera @syedbarkath980 l’ha presa 17 giorni fa e non c’è nessuna pull request aperta. ApertaAwaiting Maintainer Approval Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
processing/p5.js-web-editor#4344 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
signup form gets stuck when signup request fails due to network errorForse già presa @PS01K l’ha presa 47 giorni fa. ApertaAwaiting Maintainer Approval Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
processing/p5.js-web-editor#4285 · 3 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
Enhancement: Memoize sketches list and pagination selectors in SketchList.jsx to prevent redundant rendering cyclesForse già presa @nodeanurag l’ha presa 5 giorni fa. ApertaEnhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
processing/p5.js-web-editor#4270 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di processing/p5.js-web-editor
Issue simili
-
Correction: IMOU Cruiser 4MPApertacorrection via-web
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
ch-bas/cctv-camera-database#416 ·
I maintainer di solito rispondono entro 1 giorno
-
bug effort:medium model:light tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
documentation help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
piskyRpapalo/preceptoros-web#231 ·
I maintainer di solito rispondono entro 1 giorno
-
type/bug type/docs type/enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
Redo-San/RedoSan-Authenticity#574 ·
I maintainer di solito rispondono entro 1 giorno
-
Place search spins forever when nominatim failsForse già presa @jgt87 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
anvaka/city-roads#213 ·