Skip to content

fix: prevent duplicate event listeners on contracts buttons#453

Merged
rdmueller merged 1 commit into
LLM-Coding:mainfrom
raifdmueller:fix/contracts-duplicate-listeners
Apr 30, 2026
Merged

fix: prevent duplicate event listeners on contracts buttons#453
rdmueller merged 1 commit into
LLM-Coding:mainfrom
raifdmueller:fix/contracts-duplicate-listeners

Conversation

@raifdmueller
Copy link
Copy Markdown
Contributor

@raifdmueller raifdmueller commented Apr 30, 2026

Summary

Fix multiple downloads/copies triggered per click on the contracts page.

initContractsPage() is called repeatedly (via Select All / Deselect All),
but buttons were never cleaned up — each call added another click handler.
Now uses cloneNode to replace buttons before re-attaching, same pattern
as the grid.

Test plan

  • Click Select All, then Download — exactly one file downloaded
  • Click Select All 5x, then Copy — clipboard contains content once
  • Select All / Deselect All still work correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

Änderungen

  • Fehlerbehebungen
    • Verbesserte Zuverlässigkeit der Schaltflächenfunktionen auf der Vertragsseite. Die Schaltflächen für Download, Kopieren, Auswählen und Abwählen funktionieren jetzt zuverlässiger und konsistenter.

Clone buttons before re-attaching listeners in initContractsPage().
Without this, each Select All / Deselect All click added another
download/copy listener, causing multiple downloads per click.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Die Schaltflächenbindung in initContractsPage wird geändert: statt click-Listener direkt an bestehenden DOM-Elementen anzuhängen, werden die Schaltflächenknoten zunächst geklont/ersetzt und anschließend neue Listener hinzugefügt, um veraltete Listener zu löschen.

Changes

Cohort / Datei(en) Zusammenfassung
Listener-Attachment-Refaktorierung
website/src/components/contracts-page.js
Änderung des Listener-Anhängungsmechanismus: Schaltflächenknoten werden vor dem Hinzufügen neuer click-Listener geklont/ersetzt, um veraltete Listener zu entfernen. Die Kontrollfluss-Logik für Download-, Kopieren-, Alles-Auswählen- und Abwählen-Funktionen bleibt unverändert.

Estimated code review effort

🎯 3 (Moderat) | ⏱️ ~20 Minuten

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Der Pull-Request-Titel beschreibt genau das Hauptproblem, das behoben wird: doppelte Event-Listener auf Vertragsbuttons. Er ist präzise, konkret und zusammenfassend für die primäre Änderung.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@rdmueller rdmueller merged commit d32b906 into LLM-Coding:main Apr 30, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants