Skip to content

fix: rename duplicate clearBtn variable to clearFocusBtn in renderFoc…#694

Open
akhilmodi29 wants to merge 1 commit into
Charushi06:mainfrom
akhilmodi29:fix/studyplan-duplicate-clearbtn-variable
Open

fix: rename duplicate clearBtn variable to clearFocusBtn in renderFoc…#694
akhilmodi29 wants to merge 1 commit into
Charushi06:mainfrom
akhilmodi29:fix/studyplan-duplicate-clearbtn-variable

Conversation

@akhilmodi29
Copy link
Copy Markdown

Fixes #693

Problem
The clearBtn variable was declared twice in app.js:

  • First at the top level:
    const clearBtn = document.getElementById('clear-btn')
  • Second inside renderFocusTasks():
    const clearBtn = activeFocusTask.querySelector('.clear-focus-task-btn')

This variable shadowing caused:

  • The inner clearBtn shadowing the outer clearBtn
  • Clear button event listeners potentially conflicting
  • Confusing and error-prone code

Fix
Renamed the inner clearBtn to clearFocusBtn inside
renderFocusTasks() to eliminate the variable shadowing.
Updated all 3 references in that block accordingly.

Testing

  • Clear button in focus task works correctly ✅
  • Main clear button still works correctly ✅
  • No variable shadowing in app.js ✅

@akhilmodi29
Copy link
Copy Markdown
Author

@Charushi06 Please review this PR and add the required labels including gssoc:approved. This fixes the duplicate clearBtn variable shadowing bug in app.js.

Labels suggested:

  • level:beginner
  • type:bug
  • quality:clean

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.

[Bug] app.js - Duplicate clearBtn variable declaration causes variable shadowing and potential event listener conflicts

1 participant