Skip to content

[stable35] fix: register a queued handler only once - #3419

Closed
skjnldsv wants to merge 2 commits into
stable35from
fix/viewer-double-handler-registration-stable35
Closed

skjnldsv wants to merge 2 commits into
stable35from
fix/viewer-double-handler-registration-stable35

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Oct 6, 2026

Copy link
Copy Markdown
Member

Since e9a9933 the viewer registers the handlers queued in window._oca_viewer_handlers as it starts, and the DOMContentLoaded pass registers the queue again for handlers added in between. The second pass hit the first ones and logged "Could not register handler" for each. registerHandler() now returns early for a handler it already has; a different handler with the same id is still rejected.

Resolves #3362

I didn't clear the Map as suggested in the issue: @nextcloud/viewer also uses it to spot the same handler from several bundled copies, so clearing it would let duplicates back in.

The new e2e test queues a handler before the viewer starts and checks it is registered once, with no error.

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv skjnldsv added bug Something isn't working 2. developing Work in progress labels Oct 6, 2026
@skjnldsv skjnldsv self-assigned this Oct 6, 2026
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 6, 2026
@skjnldsv
skjnldsv marked this pull request as ready for review October 6, 2026 07:43
@skjnldsv

skjnldsv commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

/compile

@skjnldsv

skjnldsv commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

/backport to stable34 please

@backportbot backportbot Bot added the backport-request Pending backport by the backport-bot label Oct 6, 2026
@skjnldsv

skjnldsv commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

/backport to stable33 please

@skjnldsv

skjnldsv commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

/backport to stable32 please

@skjnldsv

skjnldsv commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

/backport to stable31 please

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@skjnldsv
skjnldsv requested review from blizzz and silverkszlo October 6, 2026 08:25
@skjnldsv

skjnldsv commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

Superseded by the backports of #3418 (#3421, #3422, #3423): they skip queued handlers that are already registered, which stops these duplicate errors on 33 to 35.

@skjnldsv skjnldsv closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews backport-request Pending backport by the backport-bot bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants