Skip to content

Refactor: mark query and handler properties as readonly#1307

Merged
iOvergaard merged 5 commits intomainfrom
refactor/readonly-properties
Feb 27, 2026
Merged

Refactor: mark query and handler properties as readonly#1307
iOvergaard merged 5 commits intomainfrom
refactor/readonly-properties

Conversation

@iOvergaard
Copy link
Copy Markdown
Contributor

@iOvergaard iOvergaard commented Feb 27, 2026

Summary

  • Mark all @query, @queryAll, and @queryAssignedElements decorated properties as readonly — these are getter-based and never directly assigned
  • Mark arrow function handler properties as readonly — these are initialized once and never reassigned
  • 25 files changed, 47 substitutions (purely mechanical, no behavioral change)

Test plan

  • TypeScript type-check passes with no new errors
  • Existing tests still pass (npm run test)

🤖 Generated with Claude Code

iOvergaard and others added 2 commits February 27, 2026 11:11
These Lit decorator properties create getters and are never directly
assigned, so they should be marked readonly for correctness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These properties are initialized with arrow functions and never
reassigned, so they should be marked readonly for correctness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 27, 2026 10:14
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a mechanical TypeScript refactor across Lit-based components to express immutability by marking @query/@queryAll/@queryAssignedElements decorated properties and arrow-function handler properties as readonly.

Changes:

  • Mark decorated query properties as readonly across components.
  • Mark arrow-function handler properties as readonly where they are intended to be stable references.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/toast-notification/toast-notification.element.ts Marks @query element reference as readonly.
src/components/toast-notification-container/toast-notification-container.element.ts Marks internal slot/close handlers as readonly.
src/components/textarea/textarea.element.ts Marks textarea @query reference as readonly.
src/components/tabs/tab-group.element.ts Marks queried elements and assigned elements array as readonly.
src/components/table/table-row.element.ts Marks assigned slot cell nodes as readonly.
src/components/slider/slider.element.ts Marks queried elements and resize handler as readonly.
src/components/select/select.element.ts Marks native select @query reference as readonly.
src/components/responsive-container/responsive-container.element.ts Marks queried elements and assigned elements array as readonly.
src/components/ref-node/ref-node.element.ts Marks queried element reference as readonly.
src/components/range-slider/range-slider.element.ts Marks multiple queried element references as readonly.
src/components/radio/radio.element.ts Marks input @query reference as readonly.
src/components/pagination/pagination.element.ts Marks queried button list and pages group as readonly.
src/components/modal/modal.element.ts Marks dialog @query reference as readonly.
src/components/input/input.element.ts Marks input @query reference as readonly.
src/components/input-file/input-file.element.ts Marks queried dropzone references as readonly.
src/components/icon-registry/UUIIconRegistry.ts Marks icon request handler property as readonly.
src/components/file-dropzone/file-dropzone.element.ts Marks queried input/dropzone references as readonly.
src/components/combobox/combobox.element.ts Marks queried combobox elements/assigned list as readonly.
src/components/combobox/combobox-async-options-example.ts Marks async fetch handler as readonly.
src/components/combobox/combobox-async-example.ts Marks async fetch/search handlers as readonly.
src/components/combobox-list/combobox-list.element.ts Marks assigned option collections as readonly.
src/components/color-picker/color-picker.element.ts Marks queried input/preview/swatches as readonly.
src/components/button/button.element.ts Marks button @query reference as readonly.
src/components/breadcrumbs/breadcrumbs.element.ts Marks assigned breadcrumb nodes collection as readonly.
src/components/boolean-input/boolean-input.element.ts Marks input @query reference as readonly.
Comments suppressed due to low confidence (1)

src/components/toast-notification-container/toast-notification-container.element.ts:82

  • PR description says arrow-function handler properties are being marked readonly, but in this file pauseAutoClose / resumeAutoClose are still mutable arrow properties. Either mark those as readonly as well (if they’re intended to be stable handler references) or adjust the PR description/scope so it’s clear which handlers are covered.
  private readonly onToastClosed = (e: UUIToastNotificationEvent) => {
    this.removeToast(e.target);

Comment thread src/components/input/input.element.ts
Comment thread src/components/input-file/input-file.element.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net

@iOvergaard iOvergaard added the internal Updates to dependencies, rewrite of files, cleanup, chores label Feb 27, 2026
@iOvergaard iOvergaard merged commit 94a5fe3 into main Feb 27, 2026
10 of 11 checks passed
@iOvergaard iOvergaard deleted the refactor/readonly-properties branch February 27, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Updates to dependencies, rewrite of files, cleanup, chores

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants