Skip to content

Conversation

@myabc
Copy link
Contributor

@myabc myabc commented Jan 7, 2026

Ticket

https://community.openproject.org/wp/70292

What are you trying to accomplish?

Screenshots

What approach did you choose and why?

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)


if (cb.checked) {
const multi = this.multiSelectTargets[0] as HTMLInputElement|undefined;
const multi = undefined; // FIXME this.multiSelectTargets[0] as HTMLInputElement|undefined;

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable multi.

Copilot Autofix

AI 4 days ago

In general, unused variables should be removed when they are not read anywhere, especially if any logic depending on them is already commented out. If future logic is planned, that intent can be captured in comments or TODO/FIXME notes without introducing dead code.

Here, the multi variable on line 153 is never used. The logic that would have referenced it is commented out. To fix this without changing behavior, delete the const multi = ... line, but keep the FIXME comment so the future plan remains documented. No imports or additional methods are needed. Only the uncheckOtherDefaults method in frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts needs editing, removing that single declaration line.

Suggested changeset 1
frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts b/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts
--- a/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts
@@ -150,8 +150,7 @@
     const cb = event.target as HTMLInputElement;
 
     if (cb.checked) {
-      const multi = undefined; // FIXME this.multiSelectTargets[0] as HTMLInputElement|undefined;
-
+      // FIXME use this.multiSelectTargets[0] as HTMLInputElement|undefined
       // if (multi?.checked === false) {
       //   this.customOptionDefaultsTargets.forEach((el) => (el.checked = false));
       //   cb.checked = true;
EOF
@@ -150,8 +150,7 @@
const cb = event.target as HTMLInputElement;

if (cb.checked) {
const multi = undefined; // FIXME this.multiSelectTargets[0] as HTMLInputElement|undefined;

// FIXME use this.multiSelectTargets[0] as HTMLInputElement|undefined
// if (multi?.checked === false) {
// this.customOptionDefaultsTargets.forEach((el) => (el.checked = false));
// cb.checked = true;
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants