# Variable updating on second click but not first

**URL:** <https://forum.finsweet.com/t/variable-updating-on-second-click-but-not-first/3070>\
**Category:** General\
**Created:** [June 25, 2024, 8:33pm UTC](https://forum.finsweet.com/t/variable-updating-on-second-click-but-not-first/3070 "2024-06-25T20:33:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![damien](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/damien/32/2510_2.png) [@damien](https://forum.finsweet.com/u/damien)\
**Post date:** [June 25, 2024, 8:33pm UTC](https://forum.finsweet.com/t/variable-updating-on-second-click-but-not-first/3070/1 "2024-06-25T20:33:23Z")

</div>

Hey there!

I encountered an issue with a dropdown feature in my project. When I click the button to trigger the dropdown, it only works on the second click, not the first.

**Steps to Reproduce:**

1. Click the show/hide button.
2. Observe that the dropdown does not activate on the first click but does on the second click.

**Setup Details:**

- The feature is supposed to work by setting the class `active` when `showCalendar` is true.
- Upon the first click, nothing changes. It only starts working on the second click.
- I have implemented an `onClick` event that sets a variable and toggles visibility.
- The button rotates once `showCalendar` is true, indicating that the class `active` is correctly set.
- The dropdown component appears after the second click.

**Additional Information:**

- The same setup works perfectly with other buttons.
- The calendar component should drop down and become visible when `showCalendar` is set to true.
- Clicking the background should hide the dropdown as intended.

Could you please help identify why the dropdown doesn’t work on the first click and what might need to be adjusted?

Here’s a recording of whats happening:  
https://www.loom.com/embed/7258fea8c13e4bf8be1c7dca09eccc87

---

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [June 26, 2024, 10:39am UTC](https://forum.finsweet.com/t/variable-updating-on-second-click-but-not-first/3070/2 "2024-06-26T10:39:25Z")

</div>

Hello @damien!

You can reach the Wized Support team here → [Support](https://www.wized.com/support)
