Skip to content

Commit 24a3db0

Browse files
committed
chore(accordion): clarifying group update handler variable naming
1 parent c1973cc commit 24a3db0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/src/components/accordion/accordion.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ const enum AccordionState {
3838
})
3939
export class Accordion implements ComponentInterface {
4040
private accordionGroupEl?: HTMLIonAccordionGroupElement | null;
41-
private updateListener = () => {
41+
private accordionGroupUpdateHandler = () => {
4242
/**
4343
* Determine if this update will cause an actual state change.
4444
* We only want to mark as "interacted" if the state is changing.
4545
*/
4646
const accordionGroup = this.accordionGroupEl;
4747
if (accordionGroup) {
48-
const groupValue = accordionGroup.value;
49-
const value = this.value;
50-
const shouldExpand = Array.isArray(groupValue) ? groupValue.includes(value) : groupValue === value;
48+
const value = accordionGroup.value;
49+
const accordionValue = this.value;
50+
const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
5151
const isExpanded = this.state === AccordionState.Expanded || this.state === AccordionState.Expanding;
5252
const stateWillChange = shouldExpand !== isExpanded;
5353

@@ -65,7 +65,7 @@ export class Accordion implements ComponentInterface {
6565
* This prevents the initial undefined value from the group's componentDidLoad
6666
* from being treated as the first real update.
6767
*/
68-
if (groupValue !== undefined) {
68+
if (value !== undefined) {
6969
this.hasReceivedFirstUpdate = true;
7070
}
7171
}
@@ -141,14 +141,14 @@ export class Accordion implements ComponentInterface {
141141
const accordionGroupEl = (this.accordionGroupEl = this.el?.closest('ion-accordion-group'));
142142
if (accordionGroupEl) {
143143
this.updateState();
144-
addEventListener(accordionGroupEl, 'ionValueChange', this.updateListener);
144+
addEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
145145
}
146146
}
147147

148148
disconnectedCallback() {
149149
const accordionGroupEl = this.accordionGroupEl;
150150
if (accordionGroupEl) {
151-
removeEventListener(accordionGroupEl, 'ionValueChange', this.updateListener);
151+
removeEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
152152
}
153153
}
154154

0 commit comments

Comments
 (0)