Course home: clearing `start_course` adds a history entry
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 80/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, react
- Ambito
- frontend
Direzione di ricerca
Inizia in src/course-home/outline-tab/OutlineTab.jsx intorno alle righe 102-117: l'effetto che rimuove ?start_course=1 dopo l'invio di enrollment.email.clicked.startcourse; la chiamata passa replace: true dentro l'oggetto To invece del secondo argomento options. Confronta con WeeklyLearningGoalCard.jsx, che usa ancora history.replace per weekly_goal. Leggi la documentazione v6 di useNavigate su options.replace, poi controlla i test esistenti di outline-tab per la configurazione del router e aggiungi un caso che asserisce che la navigazione di pulizia era un replace, non un push. Fatto significa che Indietro lascia la home del corso dopo essere arrivati con ?start_course=1, l'evento scatta una volta, e quel test fallisce rispetto alla chiamata attuale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Clearing start_course adds a history entry. When a learner opens the course home from the enrollment email, the outline tab sends the enrollment.email.clicked.startcourse event and takes ?start_course=1 out of the address. It does that with a new history entry, where it means to replace the current one. Back then returns to the ?start_course=1 address, the event is sent a second time, and the learner is moved forward again. It has been this way since #1128 (2023-10), the React Router v6 upgrade.
A test of the same call shows the router recording the navigation as a push. What Back does follows from that and has not been watched in a browser.
Status (2026-11-18): fixed in the frontend-base version of Learning, the package under frontend-base/ on the frontend-base branch, by #2252. The frontend-build and frontend-platform version under src/ still has it.
[!NOTE]
This issue was written by Claude (Claude Code) and reviewed before posting.
Claude Plan
Mechanism
-
OutlineTab.jsxclears the parameter withnavigate({ pathname, search, replace: true }):replaceis a key of the first argument. -
React Router's
navigatetakesreplacein its second argument. From theuseNavigatepage of the v6 documentation:Either pass a
Tovalue (same type as<Link to>) with an optional secondoptionsargumentand, under
options.replace:Specifying
replace: truewill cause the navigation to replace the current entry in the history stack instead of adding a new one. -
A
Toobject carries a pathname, a search string and a hash. Areplacekey in it is not read, so the call navigates with the default, a push.
History
- #1128 (2023-10-05) turned
history.replace({ search: currentParams.toString() })into thenavigatecall and putreplace: truein the first argument (the commit). - The weekly goal card's cleanup of
weekly_goal, inWeeklyLearningGoalCard.jsx, still callshistory.replaceand is not affected.
What a learner sees
After arriving with ?start_course=1, the history holds two entries for the course home: the address with the parameter, and the one without. Back goes to the first. The effect runs again there, sends enrollment.email.clicked.startcourse again and adds the clean address again. Each press of Back repeats that, so Back does not leave the page and the event is counted once per press.
Fix
navigate({ pathname, search }, { replace: true }), with a case that fails when the cleanup adds an entry. #2252 does this in the frontend-base package: its case asserts that the router's last navigation was a replace, and it fails with the call as it is here, the router reporting a push.
Acceptance
- After arriving with
?start_course=1, Back leaves the course home -
enrollment.email.clicked.startcourseis sent once - A test fails if the cleanup adds a history entry
- Lingua principale
- JavaScript
- Stelle
- 71
- Fork
- 341
- Merge medio
- 4g 18h
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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 openedx/frontend-app-learning
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openedx/frontend-app-learning#2250 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
openedx/frontend-app-learning#2147 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 94/100
openedx/frontend-app-learning#2119 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openedx/frontend-app-learning#2059 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
openedx/frontend-app-learning#2051 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openedx/frontend-app-learning
Issue simili
-
type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
ai-amazon-bedrock: a tool result that isn't a JSON object fails the next requestForse già presa @effect-bot l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
[bug] Toolchain versions from `.prototools` are not inherited when moon runs from a subdirectoryAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Edit: Tele1 Logo [SV]Apertacheck:passed logos:edit
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno