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:
- Put a valid viewer handler in the global Map before
viewer-init executes.
- Execute eager initialization: the handler becomes available synchronously.
- 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: #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.
Repository: https://github.com/nextcloud/viewer
src/init.tseagerly registers handlers fromwindow._oca_viewer_handlers, but leaves the Map populated. TheDOMContentLoadedlistener insrc/views/Viewer.vuethen 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.6andv33.0.8tags and stable33 revisionc83b93333a27ca12f6f9c120e6e3079720716b1c. This concerns handlers present before eager initialization; it does not claim to cover every later registration sequence.Reproduction:
viewer-initexecutes.DOMContentLoadedbridge: 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: #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.