Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Clear handlers consumed by eager initialization before DOMContentLoaded replay

Aperta Adatta ai principianti
#3,362 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, typescript
Ambito
frontend

Direzione di ricerca

Inizia in src/init.ts e confronta il consumo immediato di window._oca_viewer_handlers con il bridge DOMContentLoaded in src/views/Viewer.vue. Verifica i test del codice sorgente esistenti per la registrazione immediata, gli handler messi in coda successivamente, le Maps mancanti, i componenti non validi e gli ID duplicati. Il lavoro è completato quando le voci consumate non vengono riprodotte nuovamente, le voci successive continuano a funzionare e le registrazioni effettivamente non valide o duplicate continuano a essere rifiutate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

3. to review

Repository: https://github.com/nextcloud/viewer

src/init.ts eagerly registers handlers from window._oca_viewer_handlers, but leaves the Map populated. The DOMContentLoaded listener in src/views/Viewer.vue then registers those same handlers again. ViewerService rejects the duplicate IDs and logs errors during normal navigation.

Verified against the files in the Nextcloud v33.0.6 and v33.0.8 tags and stable33 revision c83b93333a27ca12f6f9c120e6e3079720716b1c. This concerns handlers present before eager initialization; it does not claim to cover every later registration sequence.

Reproduction:

  1. Put a valid viewer handler in the global Map before viewer-init executes.
  2. Execute eager initialization: the handler becomes available synchronously.
  3. Fire the existing DOMContentLoaded bridge: the same ID is registered again and rejected.

Proposed change in src/init.ts:

 if (window._oca_viewer_handlers) {
 	window._oca_viewer_handlers.forEach(handler => window.OCA.Viewer.registerHandler(handler))
+	window._oca_viewer_handlers.clear()
 }

Clear the existing Map after consuming it, preserving its identity and accepting entries queued later. Genuine duplicate or invalid registrations must continue to be rejected.

Validation: extracted source tests cover eager registration, later queued handlers, missing Map, invalid components and genuine duplicate IDs. A Chromium navigation with this change plus independent Text/Theming corrections completed without the prior console errors. That was a local response-substitution comparison, not a rebuilt release test.

Related: https://github.com/nextcloud/viewer/pull/3068 discusses the eager-registration motivation; that PR is closed and unmerged as checked on 2026-09-07. This report addresses replay of already-consumed entries while preserving synchronous initialization.

Lingua principale
Nessun dato sulla lingua
Stelle
122
Fork
75
Merge medio
4g 14h
PR unite (30g)
45

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextcloud/viewer

Tutte le issue di nextcloud/viewer

Issue simili

Altre issue su Web Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.