Skip to content

fix: remove missing resize event listener cleanup and fix copy button aria-label#727

Open
immanuwell wants to merge 1 commit into
dragonflyoss:mainfrom
immanuwell:main
Open

fix: remove missing resize event listener cleanup and fix copy button aria-label#727
immanuwell wants to merge 1 commit into
dragonflyoss:mainfrom
immanuwell:main

Conversation

@immanuwell
Copy link
Copy Markdown

Description

Two bugs fixed:

  1. window.addEventListener('resize', updatePageSize) was called inside useEffect without a cleanup in 5 components. Every time deps changed (page, alignment, data), a new listener piled on top. On a busy session that's a real leak - stale handlers keep firing and updating state on unmounted components.

  2. The copy-token IconButton in developer/tokens had aria-label="delete" - copy-paste error, screen readers called it "delete".

Related Issue

No open issue found for these.

Motivation and Context

Fix 1: added return () => window.removeEventListener('resize', updatePageSize) in each effect. For schedulers/seed-peers where updatePageSize was scoped inside if (alignment === 'card'), moved it one level up so it's reachable from the cleanup (calling removeEventListener on a never-registered listener is a safe no-op).

Fix 2: changed aria-label="delete" to aria-label="copy".

How to reproduce

Leak: open the clusters or schedulers page in card view, resize the window, then navigate away and back a few times. Each render cycle adds another resize handler with no cleanup.

Aria label: inspect the copy-token button with devtools or a screen reader - it was announced as "delete".

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

… aria-label

Signed-off-by: immanuwell <pchpr.00@list.ru>
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.

1 participant